fix(ci): token 交给 github-script 本身,不再 require @actions/github - #3186
Merged
Conversation
…ing @actions/github
`require('@actions/github')` is not resolvable from a github-script `script:`
block — the action bundles its dependencies, so the call dies at runtime with
MODULE_NOT_FOUND. Passing the token via `github-token:` makes the injected
`github` client the cross-repo one, and no second client is needed.
Found on the first run that got past parsing; the same run confirmed the
credential logging works (`CROSS_REPO_ISSUE_TOKEN: configured`).
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
失败
#3179合并触发了本仓库这个工作流的第一次运行,日志:github-script把依赖打包进自己的 bundle,script:块里require('@actions/github')解析不到。改法:根本不需要第二个客户端
把 token 交给 action 本身,注入的
github就是跨仓库客户端:回退到
GITHUB_TOKEN是必要的:没有跨仓库凭据时,report 路径仍要能在本 PR 上留言。这次运行同时证实了两件事
前两行日志不是噪音,是验证结果:
CROSS_REPO_ISSUE_TOKEN: configured—— 组织级 secret 确实生效了。在加这行日志之前,这个问题无法回答:没有跨仓库引用时任务会提前返回,配了和没配的日志完全一样。Cross-repo targets: objectstack-ai/objectstack#4475—— 关键字解析工作正常。(该目标已是 closed 状态,所以即使走到关闭逻辑也会命中already closed — skipping分支。)也就是说:失败点已经从"第一行"推进到了"最后一步"。
验证状态(如实)
require('@actions/github')最后一行是老实话:API 调用部分一次都没真正执行过。 本 PR 合并是下一次真实运行;若再失败,以 Actions 日志为准。
配套修复已推到 objectstack 的对应分支。
Generated by Claude Code