ci: add automatic Codex and Claude PR reviews#11
Conversation
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7679201a8c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| id: claude-review | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
There was a problem hiding this comment.
Skip fork PRs that cannot receive the OAuth secret
For a pull request originating from an external fork, GitHub does not expose repository secrets to a pull_request workflow, so this input is empty and the automatic review action fails authentication. Since the workflow currently runs for every PR, guard the job with a same-repository check or otherwise avoid starting the secret-dependent action for fork PRs.
Useful? React with 👍 / 👎.
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] |
There was a problem hiding this comment.
Cancel superseded review runs per pull request
When multiple commits are pushed to a PR before the preceding Claude run completes, each synchronize event starts an independent review with no per-PR concurrency group. The older run can therefore consume another review and publish feedback based on a superseded checkout after the newer run; add PR-number-based concurrency with cancel-in-progress as used by the existing AI review workflow.
Useful? React with 👍 / 👎.
| pull_request_review_comment: | ||
| types: [created] | ||
| issues: | ||
| types: [opened, assigned] |
There was a problem hiding this comment.
Avoid replaying old mentions on every issue assignment
For an issue whose title or body contains @claude, every subsequent assigned event satisfies the same condition even when the new assignee is an unrelated maintainer and no new Claude request was made. An issue opened with the mention therefore runs once for opened and again whenever its assignees change, potentially duplicating work, comments, branches, and API usage; remove this event or restrict it to the intended Claude assignee.
Useful? React with 👍 / 👎.
Port the reviewed changes from PR #11 onto the dev branch.
概述
将原先由
github-actions[bot]发送@codex review的不可靠方案,替换为自动且权限受控的 Codex + Claude PR 审查:anthropics/claude-code-action,在 PR 新建、更新、转为 Ready 或重新打开时运行。github-actions[bot]发布中文启动提示;不会再发送无效的 Bot 身份@codex review。安全与可靠性
contents: read、pull-requests: write、id-token: write。认证
CLAUDE_CODE_OAUTH_TOKEN,由 Claude 官方安装流程写入。验证
git diff --checkactionlintzizmorGitHub Actions 安全审计运行说明
Claude 官方 Action 会拒绝在尚未进入默认分支、或被 PR 修改过的工作流文件上执行模型,这是其安全校验的预期行为。因此本 PR 中 Claude 步骤会安全跳过并返回成功;合并后,后续同仓库的人类作者 PR 才会进行完整 Claude 模型审查。Codex 继续使用其原生触发条件。