fix(ci): token 交给 github-script 本身,不再 require @actions/github(第三次,也是最后一层) - #4578
Merged
Conversation
…ing @actions/github
`require('@actions/github')` is not resolvable from a github-script `script:`
block — the action bundles its dependencies, so it dies with MODULE_NOT_FOUND.
Passing the token via `github-token:` makes the injected `github` client the
cross-repo one, so no second client is needed at all.
Observed in objectui, whose copy reached that line first. Supersedes the rename
in #4573: that fixed the parse-time collision, which is what let the run get
far enough to hit this.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
os-zhuang
enabled auto-merge
August 2, 2026 08:36
…-closer-require # Conflicts: # .github/workflows/cross-repo-issue-closer.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
失败
github-script把依赖打包进了自己的 bundle,script:块里require('@actions/github')解析不到。改法:根本不需要第二个客户端
把 token 交给 action 本身,注入的
github就是跨仓库客户端:回退到
GITHUB_TOKEN是必要的:没有跨仓库凭据时,report 路径仍要能在本 PR 上留言。与 #4573 的关系
本 PR 取代 #4573。 #4573 把第二个客户端从
octokit改名为crossRepo,修掉了解析期的标识符冲突——正因为如此,运行才第一次走得够远,撞上了这个解析不到的模块。本 PR 直接删掉那个客户端,冲突与模块问题一并消失。#4573 若已合入
main,本 PR 覆盖同一区域;若出现冲突,以本 PR 为准。三次运行,每次都更深一层
SyntaxError: Identifier 'octokit' has already been declaredCannot find module '@actions/github'这三次每一次都由真实运行发现,没有一次是静态检查发现的。 静态检查此前给过两次绿灯,而它回答的问题始终比运行时窄一层:第一次的包装漏了注入标识符,第二次的包装则根本不模拟模块解析。
一个已被证实有效的副产物
objectui 那次运行确认了凭据日志有用:
第一行回答了「secret 到底配没配」——在此之前这个问题无法回答,因为无跨仓库引用时任务会提前返回,配了和没配的日志完全一样。第二行说明关键字解析本身工作正常。
验证状态(如实)
require('@actions/github')(仅注释提及)objectstack-ai/objectstack#4475)最后一行是老实话:这个工作流的 API 调用部分一次都没有真正执行过。 本 PR 合并会是第四次运行;若再失败,请以 Actions 日志为准,不要采信本表。
配套修复已推到 objectui 的对应分支。
Generated by Claude Code