ci: add workflow_dispatch trigger to Claude code review#101
Conversation
Lets us re-run the agentic review on a PR without re-pushing — useful for retrying after token rotation or transient failures. Resolves the PR head ref via gh CLI so the same job body works for both event types. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe GitHub Actions workflow for Claude code review now supports manual execution via 🚥 Pre-merge checks | ✅ 8 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (8 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
@coderabbitai autofix |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b89647ab37
ℹ️ 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".
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} | ||
| run: | | ||
| HEAD_REF=$(gh pr view "$PR_NUMBER" --repo "${{ github.repository }}" --json headRefName -q .headRefName) |
There was a problem hiding this comment.
Check out the PR's exact head ref
For a manual rerun of a PR whose head branch lives in a fork, gh pr view --json headRefName resolves only the branch name, while the following actions/checkout step still defaults to checking out ${{ github.repository }}. In that case the workflow either fails to find the fork branch or reviews a same-named branch in the base repo instead of the requested PR. Resolve an exact PR ref/SHA such as headRefOid or refs/pull/<number>/head, or also pass the head repository to checkout.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds a manual trigger to the Claude agentic code review workflow so maintainers can re-run reviews against an existing PR (e.g., after token rotation or transient failures), while keeping the same job body for both pull_request and workflow_dispatch events.
Changes:
- Adds
workflow_dispatchwith a requiredpr_numberinput. - Resolves the target PR’s head ref via
gh pr viewand uses it for checkout. - Updates
if,concurrency, and prompt construction to work for both event types.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if: | | ||
| github.actor != 'coderabbitai[bot]' && | ||
| !contains(github.event.pull_request.title, '[skip review]') && | ||
| !contains(github.event.pull_request.labels.*.name, 'skip-review') | ||
| github.event_name == 'workflow_dispatch' || ( | ||
| github.actor != 'coderabbitai[bot]' && | ||
| !contains(github.event.pull_request.title, '[skip review]') && | ||
| !contains(github.event.pull_request.labels.*.name, 'skip-review') | ||
| ) |
| HEAD_REF=$(gh pr view "$PR_NUMBER" --repo "${{ github.repository }}" --json headRefName -q .headRefName) | ||
| echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT" | ||
| echo "head_ref=$HEAD_REF" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Checkout PR head | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: |
Per anthropics/claude-code-action docs (custom-automations.md), workflow_dispatch is "coming soon" — the action reads PR_NUMBER from github.event.pull_request.number || github.event.issue.number, so a dispatched run has no PR context and exits during the action's main step. Reverts the trigger and the gh-pr-view resolver added in #101. Doubles as a real-PR exercise of the rotated CLAUDE_CODE_OAUTH_TOKEN. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
workflow_dispatch(with requiredpr_numberinput) toclaude-code-review.ymlso we can re-run the agentic review on a PR without re-pushing — handy for verifying a rotatedCLAUDE_CODE_OAUTH_TOKENor retrying after a transient failure.gh pr viewin a setup step so the same job body works for bothpull_requestandworkflow_dispatchevents.if,concurrency, and prompt expressions to use the resolved PR number from either event source.Test plan
gh workflow run claude-code-review.yml -R ANcpLua/ANcpLua.Analyzers -f pr_number=<PR>against an existing PR and confirm the review job kicks off.pull_requestflow still triggers (next dependency PR will exercise this).🤖 Generated with Claude Code
Summary by CodeRabbit