Skip to content

fix(ci): token 交给 github-script 本身,不再 require @actions/github - #3186

Merged
os-zhuang merged 1 commit into
mainfrom
claude/fix-cross-repo-closer-require
Aug 2, 2026
Merged

fix(ci): token 交给 github-script 本身,不再 require @actions/github#3186
os-zhuang merged 1 commit into
mainfrom
claude/fix-cross-repo-closer-require

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

失败

#3179 合并触发了本仓库这个工作流的第一次运行,日志:

CROSS_REPO_ISSUE_TOKEN: configured
Cross-repo targets: objectstack-ai/objectstack#4475
Error: Cannot find module '@actions/github'
Require stack:
- /home/runner/work/_actions/actions/github-script/v9/dist/index.js

github-script 把依赖打包进自己的 bundle,script: 块里 require('@actions/github') 解析不到

改法:根本不需要第二个客户端

把 token 交给 action 本身,注入的 github 就是跨仓库客户端:

github-token: ${{ secrets.CROSS_REPO_ISSUE_TOKEN || secrets.GITHUB_TOKEN }}

回退到 GITHUB_TOKEN 是必要的:没有跨仓库凭据时,report 路径仍要能在本 PR 上留言。

这次运行同时证实了两件事

前两行日志不是噪音,是验证结果:

  • CROSS_REPO_ISSUE_TOKEN: configured —— 组织级 secret 确实生效了。在加这行日志之前,这个问题无法回答:没有跨仓库引用时任务会提前返回,配了和没配的日志完全一样。
  • Cross-repo targets: objectstack-ai/objectstack#4475 —— 关键字解析工作正常。(该目标已是 closed 状态,所以即使走到关闭逻辑也会命中 already closed — skipping 分支。)

也就是说:失败点已经从"第一行"推进到了"最后一步"。

验证状态(如实)

状态
YAML 解析 · 脚本语法
脚本内已无 require('@actions/github')
凭据日志有效 真实运行证实
关键字解析有效 真实运行证实
关闭/评论的 API 调用路径 仍未实测

最后一行是老实话:API 调用部分一次都没真正执行过。 本 PR 合并是下一次真实运行;若再失败,以 Actions 日志为准。

配套修复已推到 objectstack 的对应分支。


Generated by Claude Code

…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`).
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Aug 2, 2026 8:35am

Request Review

@os-zhuang
os-zhuang added this pull request to the merge queue Aug 2, 2026
Merged via the queue into main with commit f07d5c7 Aug 2, 2026
15 checks passed
@os-zhuang
os-zhuang deleted the claude/fix-cross-repo-closer-require branch August 2, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants