Skip to content

ci: add workflow_dispatch trigger to Claude code review#101

Merged
github-actions[bot] merged 1 commit into
mainfrom
ci/workflow-dispatch-claude-review
May 5, 2026
Merged

ci: add workflow_dispatch trigger to Claude code review#101
github-actions[bot] merged 1 commit into
mainfrom
ci/workflow-dispatch-claude-review

Conversation

@ANcpLua
Copy link
Copy Markdown
Owner

@ANcpLua ANcpLua commented May 5, 2026

Summary

  • Adds workflow_dispatch (with required pr_number input) to claude-code-review.yml so we can re-run the agentic review on a PR without re-pushing — handy for verifying a rotated CLAUDE_CODE_OAUTH_TOKEN or retrying after a transient failure.
  • Resolves the PR head ref via gh pr view in a setup step so the same job body works for both pull_request and workflow_dispatch events.
  • Updates the if, concurrency, and prompt expressions to use the resolved PR number from either event source.

Test plan

  • After merge, run 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.
  • Confirm normal pull_request flow still triggers (next dependency PR will exercise this).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced the code review workflow to support manual execution in addition to automatic pull request triggers, with improved PR reference resolution and checkout handling for greater workflow flexibility.

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>
Copilot AI review requested due to automatic review settings May 5, 2026 01:34
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The GitHub Actions workflow for Claude code review now supports manual execution via workflow_dispatch with a required pr_number input parameter. The job conditions were updated to run on both workflow_dispatch and pull_request events. A new "Resolve PR" step was added that uses GitHub CLI to fetch the PR's head reference name and exports both the PR number and head ref as outputs. The checkout step now uses the resolved head ref instead of directly referencing the pull request event object. The Claude review prompt invocation was updated to target the resolved PR number output.

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
No Null-Forgiving Operator Without Justification ⚠️ Warning Multiple null-forgiving operators in added C# files lack inline comments. Examples: docsFile!, unshippedFile!, qualified!, sourceMethod = null!, method = null! in analyzers and code-fix providers. Add inline comments to all null-forgiving operators explaining why they cannot be rewritten. Check files: AL0054ToAL0056, AL0134UseSemanticConvention, AL0117Unnecessary, AL0053Unnecessary.
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows conventional commits format (ci:), is under 72 chars (55 chars), uses lowercase, no trailing period, and accurately describes the main change: adding workflow_dispatch trigger support to the Claude code review workflow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No Datetime.Now/Utcnow In Analyzer Code ✅ Passed PR modifies only .github/workflows/claude-code-review.yml (workflow YAML). Check scans C# files under src/ for DateTime.Now/UtcNow—not applicable to workflow configuration.
No .Result/.Wait() Blocking Async ✅ Passed No C# files were modified in this PR. Changes are limited to .github/workflows/claude-code-review.yml (YAML workflow config). Check not applicable.
No Isourcegenerator ✅ Passed No C# files were added or modified in this PR. The change is limited to GitHub Actions workflow configuration (.github/workflows/claude-code-review.yml). The custom check is not applicable.
No Isymbol Stored In Incremental Models ✅ Passed All record/class types in the C# code use only value-equatable data (strings, ints, ImmutableArray). No ISymbol, SyntaxNode, or Compilation members found in incremental models.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

@coderabbitai autofix

@github-actions github-actions Bot enabled auto-merge (squash) May 5, 2026 01:34
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@github-actions github-actions Bot merged commit 52288db into main May 5, 2026
20 of 22 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_dispatch with a required pr_number input.
  • Resolves the target PR’s head ref via gh pr view and 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.

Comment on lines 25 to +30
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')
)
Comment on lines +42 to 48
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:
github-actions Bot pushed a commit that referenced this pull request May 5, 2026
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>
@ANcpLua ANcpLua deleted the ci/workflow-dispatch-claude-review branch May 5, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants