Skip to content

Conversation

@PeterDaveHello
Copy link
Owner

@PeterDaveHello PeterDaveHello commented Feb 8, 2026

Enable Claude Code online review in GitHub Actions and limit fork-triggered pull_request_target runs to review_requested so maintainers explicitly gate those review runs.

GitHub Copilot pull request summary:

This pull request introduces a new GitHub Actions workflow to automate code reviews using Claude. The workflow is designed with strong security checks to prevent prompt injection and ensure sensitive files are handled safely, especially for pull requests from forks.

New Claude Code Review workflow:

Security and workflow change detection:

  • Implements logic to detect changes to sensitive files and directories (e.g., .github/workflows/, .github/actions/, AGENTS.md, CLAUDE.md) in pull requests, preventing the review from running if such files are modified in fork PRs.
  • Adds safeguards for large PRs (3000+ files), skipping the review to avoid bypassing security checks.

Workflow configuration and execution:

  • Sets up concurrency controls to prevent accidental cancellation between pull_request and pull_request_target events.
  • Specifies permissions to limit access and enhance security for contents, pull-requests, and issues.
  • Uses conditional logic to ensure the review only runs for trusted PRs or when sensitive files are not changed in fork PRs.

Claude integration:

  • Integrates the anthropics/claude-code-action with a prompt tailored for code review, referencing repository conventions and using GitHub CLI tools for commenting and

Summary by CodeRabbit

  • New Features
    • Adds an automated AI-powered code review on pull requests that comments on quality, bugs, performance, security, and tests.
    • Skips reviews for PRs that modify workflows/configuration or are extremely large to avoid noisy or unsafe runs.
    • Enforces fork-PR protections, concurrency control, conditional execution, and a 20-minute timeout for safer, predictable reviews.

@gemini-code-assist
Copy link

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@qodo-free-for-open-source-projects

Review Summary by Qodo

Add Claude Code Review GitHub Actions workflow

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Adds automated Claude Code Review workflow for GitHub PRs
• Implements security checks to prevent prompt injection attacks
• Limits fork PR reviews to explicit maintainer review requests
• Detects sensitive file changes and skips review for large PRs
Diagram
flowchart LR
  PR["Pull Request Event"]
  FORK{Fork PR?}
  REVIEW{Review Requested?}
  CHECKOUT["Checkout Repository"]
  DETECT["Detect Workflow Changes"]
  SENSITIVE{Sensitive Files Changed?}
  CLAUDE["Run Claude Code Review"]
  COMMENT["Post Review Comment"]
  
  PR --> FORK
  FORK -->|Non-fork| CHECKOUT
  FORK -->|Fork| REVIEW
  REVIEW -->|Yes| CHECKOUT
  REVIEW -->|No| END1["Skip Review"]
  CHECKOUT --> DETECT
  DETECT --> SENSITIVE
  SENSITIVE -->|No| CLAUDE
  SENSITIVE -->|Yes| END2["Skip Review"]
  CLAUDE --> COMMENT
Loading

Grey Divider

File Changes

1. .github/workflows/claude-code-review.yml ✨ Enhancement +128/-0

New Claude Code Review workflow with security checks

• Creates new GitHub Actions workflow triggered on PR open/sync/reopen and review requests
• Implements dual-event strategy: pull_request for trusted repos, pull_request_target for forks
• Detects changes to sensitive files (.github/workflows/, .github/actions/, AGENTS.md,
 CLAUDE.md) and skips review if found in fork PRs
• Integrates Claude Code Action with security-restricted bash tools (gh pr comment, gh pr diff,
 gh pr view)
• Includes safeguards for large PRs (3000+ files) to prevent security bypass attempts

.github/workflows/claude-code-review.yml


Grey Divider

Qodo Logo

@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow .github/workflows/claude-code-review.yml that runs Claude-based code reviews on pull requests, detects undeterminable PRs, very large diffs, and sensitive workflow/path changes, and conditionally skips the review for flagged or forked PRs.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/claude-code-review.yml
New workflow "Claude Code Review": triggers on pull_request and pull_request_target, sets concurrency and permissions, uses checkout with explicit ref handling to mitigate prompt-injection for fork PRs, runs a detection step via actions/github-script to set workflows_changed when PR number can't be determined, diff size ≥3000 files, or sensitive files/paths changed/renamed (AGENTS.md, CLAUDE.md, .github/workflows/, .github/actions/), and conditionally invokes anthropics/claude-code-action to run a code review and post comments via gh CLI.

Sequence Diagram(s)

sequenceDiagram
  participant GitHub as GitHub Events
  participant Runner as Actions Runner
  participant Checkout as actions/checkout
  participant Script as actions/github-script
  participant ClaudeAction as anthropics/claude-code-action
  participant GH as gh CLI / GitHub API

  GitHub->>Runner: trigger on pull_request / pull_request_target
  Runner->>Checkout: checkout repo (explicit ref selection for forks)
  Runner->>Script: infer PR number, list changed files, detect workflows/sensitive changes, check diff size
  Script-->>Runner: set workflows_changed flag (true/false) and PR determinability
  alt workflows_changed == true OR PR undeterminable OR diff too large OR excluded
    Runner-->>GitHub: skip Claude review
  else
    Runner->>ClaudeAction: run Claude review (env + API key)
    ClaudeAction->>GH: run `gh pr diff` and `gh pr comment` to post findings
    ClaudeAction-->>Runner: completed review
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped along the CI line with glee,
I checked each path, each diff, each key,
I sniffed for big changes, secrets, and more,
Then nudged Claude to peer through the door,
A tiny hop — a tidy review for thee 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Claude Code PR review GitHub Actions CI workflow' directly and clearly describes the main change: introducing a new GitHub Actions workflow for Claude Code automated reviews.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-claude-code-review-ci-workflow

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

@PeterDaveHello PeterDaveHello changed the title Add Claude Code PR review workflow Add Claude Code PR review GitHub Actions CI workflow Feb 8, 2026
@kiloconnect
Copy link

kiloconnect bot commented Feb 8, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR adds a well-structured GitHub Actions workflow for automated Claude Code reviews on pull requests. The security posture is strong:

  • ✅ All action references are SHA-pinned and verified (actions/[email protected], actions/[email protected], anthropics/[email protected])
  • pull_request_target is used correctly with base SHA checkout to prevent prompt injection from fork PRs
  • ✅ Sensitive file detection (.github/workflows/, AGENTS.md, CLAUDE.md) with fail-closed defaults
  • ✅ 3000-file API limit handled with fail-closed logic
  • ✅ Claude's tool access is properly restricted to gh pr comment/diff/view
  • persist-credentials: false limits git credential exposure
  • ✅ Fork PR reviews require explicit review_requested by the repository owner
  • ✅ Concurrency controls prevent duplicate runs

Other reviewers have already flagged relevant items (trust boundary for same-repo PRs, model ID validity). No additional issues found from this review.

Files Reviewed (1 file)
  • .github/workflows/claude-code-review.yml - 0 new issues (136 lines added)

Copy link

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 GitHub Actions workflow to run automated Claude-based PR reviews, with a fork-safe pull_request_target path gated by explicit maintainer action and additional checks to prevent running when sensitive workflow/instruction files are modified.

Changes:

  • Introduces a new claude-code-review.yml workflow that runs on pull_request for non-fork PRs and on pull_request_target (only review_requested) for fork PRs.
  • Adds a github-script step to detect changes to sensitive paths/files and fail-closed (including 3000+ file PRs) to avoid bypassing safeguards.
  • Runs anthropics/claude-code-action with restricted gh tool access to post review comments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

persist-credentials: false

- name: Detect workflow changes
id: workflow_changes
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

The "Detect workflow changes" step is only used to gate pull_request_target (fork) runs, but it still calls the API on every pull_request run. Consider adding an if: github.event_name == 'pull_request_target' to this step (or moving it behind a job/step condition) to reduce unnecessary API calls and avoid extra failure surface on normal PR events.

Suggested change
id: workflow_changes
id: workflow_changes
if: github.event_name == 'pull_request_target'

Copilot uses AI. Check for mistakes.
@qodo-free-for-open-source-projects
Copy link

qodo-free-for-open-source-projects bot commented Feb 8, 2026

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Secrets on pull_request 🐞 Bug ⛨ Security
Description
• The workflow intentionally runs on pull_request for non-fork PRs and passes
  ANTHROPIC_API_KEY/GITHUB_TOKEN to the action; any same-repo PR will execute this workflow with
  those secrets available.
• Because pull_request runs use the workflow definition from the PR’s code, a same-repo PR can
  modify this workflow (e.g., expand allowed tools/steps) and immediately run the modified workflow
  with secrets, which is a high-impact trust-boundary decision.
• The workflow explicitly applies “sensitive file” skipping only for fork PRs; same-repo PRs are
  allowed to modify .github/workflows/* and still run this job.
Code

.github/workflows/claude-code-review.yml[R3-27]

+on:
+  pull_request:
+    types: [opened, synchronize, reopened, ready_for_review]
+  pull_request_target:
+    types: [review_requested]
+
+concurrency:
+  # Include event_name to prevent pull_request and pull_request_target from canceling each other
+  # This ensures non-fork PRs aren't accidentally canceled by the skipped pull_request_target run
+  group: claude-pr-review-${{ github.event_name }}-${{ github.event.pull_request.number }}
+  cancel-in-progress: true
+
+permissions:
+  contents: read
+  pull-requests: write
+  issues: write
+
+jobs:
+  claude_review:
+    if: |
+      (github.event_name == 'pull_request' &&
+        github.event.pull_request.head.repo.fork == false) ||
+      (github.event_name == 'pull_request_target' &&
+        github.event.pull_request.head.repo.fork == true)
+    runs-on: ubuntu-latest
Evidence
The workflow triggers on pull_request for non-forks and provides secrets to a third-party action.
The in-file comments confirm that sensitive-file checks are only enforced for fork PRs, leaving
same-repo PRs (including ones that change workflow files) within the trusted boundary.

.github/workflows/claude-code-review.yml[3-7]
.github/workflows/claude-code-review.yml[21-26]
.github/workflows/claude-code-review.yml[98-103]
.github/workflows/claude-code-review.yml[104-109]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow runs on `pull_request` for non-fork PRs and injects secrets into a third-party action. On `pull_request` events, workflow definitions can be taken from PR code, which means a same-repo PR can modify this workflow and have the modified version run with secrets.
### Issue Context
This is a trust-boundary decision: it may be acceptable if *all* same-repo PR authors are fully trusted, but it is high impact if that assumption is ever violated (compromised collaborator account, overly broad repo write access, etc.).
### Fix Focus Areas
- .github/workflows/claude-code-review.yml[3-7]
- .github/workflows/claude-code-review.yml[21-27]
- .github/workflows/claude-code-review.yml[96-109]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. github.paginate lacks error handling 📘 Rule violation ⛯ Reliability
Description
• The workflow’s actions/github-script step calls the GitHub API via
  github.paginate(github.rest.pulls.listFiles, ...) without any try/catch or fallback behavior.
• If the API request fails (rate limit, transient error, permissions), the step will error out
  without a controlled, actionable message or a graceful “skip review” outcome.
• This reduces workflow resilience and can unintentionally break the intended “fail closed / skip
  review” security posture in edge cases.
Code

.github/workflows/claude-code-review.yml[R63-70]

+            const files = await github.paginate(
+              github.rest.pulls.listFiles,
+              {
+                owner: context.repo.owner,
+                repo: context.repo.repo,
+                pull_number: pullNumber,
+              }
+            );
Evidence
PR Compliance ID 3 requires potential failure points (like external API calls) to be handled with
meaningful context and graceful degradation. The workflow’s GitHub API call is not wrapped with
error handling, so failures will terminate the step without the controlled skip behavior used
elsewhere in the script.

Rule 3: Generic: Robust Error Handling and Edge Case Management
.github/workflows/claude-code-review.yml[63-70]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `actions/github-script` step makes a GitHub API call (`github.paginate(...pulls.listFiles...)`) without error handling. If the request fails (rate limiting, transient network issue, permissions), the workflow will hard-fail instead of providing a controlled, informative warning and a graceful skip/fail-closed behavior.
## Issue Context
This workflow already implements “fail closed” logic for missing PR numbers and for the 3000-file API limit. Similar resilience should apply when the GitHub API request itself fails.
## Fix Focus Areas
- .github/workflows/claude-code-review.yml[63-78]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. PR diff injection risk 🐞 Bug ⛨ Security
Description
• The prompt instructs the agent to read attacker-controlled PR content (gh pr diff) and then
  perform a side effect (gh pr comment). This creates a prompt-injection surface where malicious
  diffs/descriptions can try to coerce the bot into posting unwanted content.
• Tool allowlisting reduces the worst-case impact, but it doesn’t prevent abuse like spam,
  misleading “approval” language, or disruptive @mentions in PR comments.
Code

.github/workflows/claude-code-review.yml[R110-127]

+          prompt: |
+            REPO: ${{ github.repository }}
+            PR NUMBER: ${{ github.event.pull_request.number }}
+
+            Please review this pull request and provide feedback on:
+            - Code quality and best practices
+            - Potential bugs or issues
+            - Performance considerations
+            - Security concerns
+            - Test coverage
+
+            Use the repository's AGENTS.md for guidance on style and conventions. Be constructive and helpful in your feedback.
+            Use `gh pr diff` to see the PR changes, then use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
+
+          claude_args: >
+            --model opus
+            --allowed-tools
+            "Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
Evidence
The workflow explicitly directs Claude to consume PR diffs and then post comments, and the allowed
tools include comment posting. That combination is sufficient for prompt-injection attempts to cause
externally-visible actions (even if limited to GitHub comment APIs).

.github/workflows/claude-code-review.yml[110-123]
.github/workflows/claude-code-review.yml[124-127]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow has the agent read untrusted PR content (`gh pr diff`) and then take an external action (`gh pr comment`). Without explicit prompt-injection defenses, a malicious PR can influence the bot to post unwanted/misleading content.
### Issue Context
Tool allowlisting helps, but does not eliminate abuse via comments.
### Fix Focus Areas
- .github/workflows/claude-code-review.yml[110-123]
- .github/workflows/claude-code-review.yml[124-127]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Broad token capabilities 🐞 Bug ⛨ Security
Description
• The workflow grants both pull-requests: write and issues: write, which together allow a wide
  range of write operations using GITHUB_TOKEN.
• Even if intended, this increases blast radius if the action or model behavior is ever abused; it’s
  worth validating the minimum permission set required for the exact gh operations you allow and
  removing anything else.
Code

.github/workflows/claude-code-review.yml[R15-19]

+permissions:
+  contents: read
+  pull-requests: write
+  issues: write
+
Evidence
The permissions block explicitly grants write access across PRs and issues for a job that is
intended (per prompt) to read diffs and leave a PR comment. More permissions than necessary
increases impact of any misuse.

.github/workflows/claude-code-review.yml[15-18]
.github/workflows/claude-code-review.yml[121-123]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow grants multiple write scopes for `GITHUB_TOKEN`. Minimizing these permissions reduces the blast radius of any action compromise or prompt-injection induced misuse.
### Issue Context
Which exact scope is required for `gh pr comment` can vary by how the command maps to GitHub APIs; validate in CI and keep only the minimal write permission(s).
### Fix Focus Areas
- .github/workflows/claude-code-review.yml[15-18]
- .github/workflows/claude-code-review.yml[124-127]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

5. Repeated comment noise 🐞 Bug ⛯ Reliability
Description
• The workflow triggers on synchronize and instructs the agent to post a PR comment; if the action
  posts a new comment each run, active PRs may accumulate repetitive bot comments.
• This can reduce signal-to-noise and make real human review harder to track.
Code

.github/workflows/claude-code-review.yml[R4-6]

+  pull_request:
+    types: [opened, synchronize, reopened, ready_for_review]
+  pull_request_target:
Evidence
The trigger set includes frequent update events, and the prompt directs the agent to post a comment,
which commonly results in multiple comments over the PR lifecycle unless the workflow edits/updates
an existing “sticky” comment.

.github/workflows/claude-code-review.yml[4-5]
.github/workflows/claude-code-review.yml[121-123]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Frequent triggers plus posting comments can lead to comment spam on active PRs.
### Issue Context
This is a UX/reliability concern; behavior depends on how `anthropics/claude-code-action` posts comments.
### Fix Focus Areas
- .github/workflows/claude-code-review.yml[4-7]
- .github/workflows/claude-code-review.yml[110-123]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines 3 to 27
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
pull_request_target:
types: [review_requested]

concurrency:
# Include event_name to prevent pull_request and pull_request_target from canceling each other
# This ensures non-fork PRs aren't accidentally canceled by the skipped pull_request_target run
group: claude-pr-review-${{ github.event_name }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write
issues: write

jobs:
claude_review:
if: |
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false) ||
(github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.fork == true)
runs-on: ubuntu-latest

Choose a reason for hiding this comment

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

Action required

1. Secrets on pull_request 🐞 Bug ⛨ Security

• The workflow intentionally runs on pull_request for non-fork PRs and passes
  ANTHROPIC_API_KEY/GITHUB_TOKEN to the action; any same-repo PR will execute this workflow with
  those secrets available.
• Because pull_request runs use the workflow definition from the PR’s code, a same-repo PR can
  modify this workflow (e.g., expand allowed tools/steps) and immediately run the modified workflow
  with secrets, which is a high-impact trust-boundary decision.
• The workflow explicitly applies “sensitive file” skipping only for fork PRs; same-repo PRs are
  allowed to modify .github/workflows/* and still run this job.
Agent Prompt
### Issue description
The workflow runs on `pull_request` for non-fork PRs and injects secrets into a third-party action. On `pull_request` events, workflow definitions can be taken from PR code, which means a same-repo PR can modify this workflow and have the modified version run with secrets.

### Issue Context
This is a trust-boundary decision: it may be acceptable if *all* same-repo PR authors are fully trusted, but it is high impact if that assumption is ever violated (compromised collaborator account, overly broad repo write access, etc.).

### Fix Focus Areas
- .github/workflows/claude-code-review.yml[3-7]
- .github/workflows/claude-code-review.yml[21-27]
- .github/workflows/claude-code-review.yml[96-109]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@PeterDaveHello PeterDaveHello force-pushed the add-claude-code-review-ci-workflow branch from 3470f05 to 8a758c8 Compare February 9, 2026 02:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/claude-code-review.yml:
- Around line 96-127: The workflow step with id "claude-review" sets claude_args
to include an invalid model flag "--model opus"; update that flag to a currently
supported Claude model (for example "--model claude-sonnet-4-20250514" or the
latest supported model ID) so the claude_args value uses a valid model
identifier and the action can run successfully.

Comment on lines 96 to 127
- name: Run Claude Code Review
# GitHub Actions step outputs are strings; keep the condition below comparing against 'true'.
# Note: For pull_request events (non-fork PRs from trusted contributors), we run the review
# even when sensitive files are modified. Only fork PRs (pull_request_target) check workflows_changed.
if: |
github.event_name != 'pull_request_target' ||
steps.workflow_changes.outputs.workflows_changed != 'true'
id: claude-review
uses: anthropics/claude-code-action@1b8ee3b94104046d71fde52ec3557651ad8c0d71 # v1.0.29
env:
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage

Use the repository's AGENTS.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr diff` to see the PR changes, then use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

claude_args: >
--model opus
--allowed-tools
"Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

anthropics/claude-code-action v1.0.29 release SHA

💡 Result:

anthropics/claude-code-action v1.0.29 release commit SHA: 1b8ee3b94104046d71fde52ec3557651ad8c0d71. (github.com)

Citations:


🌐 Web query:

anthropics/claude-code-action model parameter supported values opus claude-3

💡 Result:

In anthropics/claude-code-action@v1, there isn’t a dedicated model: input with an enum of supported values—you set the model via the Claude Code CLI flag in claude_args, e.g. claude_args: "--model <MODEL_ID>". The action passes claude_args through to Claude Code, so “supported values” are whatever Claude Code supports for --model. [1]

As of the current Claude Code docs, examples / supported model IDs include: claude-sonnet-4-20250514 (and newer Sonnet/Opus/Haiku variants listed in their “Supported models” section). [2]

For Claude 3 Opus, the Anthropic API model ID was claude-3-opus-20240229, but it has been retired (requests now error) as of January 5, 2026, so it’s no longer a valid value to use. [3]

Sources: [1] [2] [3]


Update model parameter to a currently supported version.

The action SHA correctly pins to v1.0.29, and the --allowed-tools restriction appropriately limits Claude's execution scope. However, the --model opus parameter is invalid: "opus" is not a valid model identifier, and the Anthropic Opus model (claude-3-opus-20240229) was retired as of January 5, 2026. This will cause the workflow to fail at runtime.

Update the model to a currently supported variant. For example, use --model claude-sonnet-4-20250514 or the latest supported model ID according to Claude Code's current documentation.

🤖 Prompt for AI Agents
In @.github/workflows/claude-code-review.yml around lines 96 - 127, The workflow
step with id "claude-review" sets claude_args to include an invalid model flag
"--model opus"; update that flag to a currently supported Claude model (for
example "--model claude-sonnet-4-20250514" or the latest supported model ID) so
the claude_args value uses a valid model identifier and the action can run
successfully.

@PeterDaveHello PeterDaveHello force-pushed the add-claude-code-review-ci-workflow branch from 8a758c8 to c35b076 Compare February 9, 2026 17:20
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/claude-code-review.yml:
- Around line 96-129: The claude-review step uses an incorrect flag and format
for tool restriction: update the claude_args in the step with id "claude-review"
to use the documented kebab-case flag "--allowed-tools" and pass the tools as a
single comma-separated argument (e.g., --allowed-tools "Bash(gh pr comment
*),Bash(gh pr diff *),Bash(gh pr view *)"); ensure the flag and value remain on
the same line/argument so the action parses the allowed tools correctly.

Comment on lines 96 to 129
- name: Run Claude Code Review
# GitHub Actions step outputs are strings; keep the condition below comparing against 'true'.
# Note: For pull_request events (non-fork PRs from trusted contributors), we run the review
# even when sensitive files are modified. Only fork PRs (pull_request_target) check workflows_changed.
if: |
github.event_name != 'pull_request_target' ||
steps.workflow_changes.outputs.workflows_changed != 'true'
id: claude-review
uses: anthropics/claude-code-action@1b8ee3b94104046d71fde52ec3557651ad8c0d71 # v1.0.29
env:
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage

Use the repository's AGENTS.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr diff` to see the PR changes, then use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

claude_args: >
--model claude-opus-4-6
--allowedTools
"Bash(gh pr comment *)"
"Bash(gh pr diff *)"
"Bash(gh pr view *)"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Anthropic Claude Code GitHub Actions --allowed-tools flag documentation

💡 Result:

In Claude Code GitHub Actions (anthropics/claude-code-action@v1), you pass tool-allowlisting via the claude_args input (which forwards Claude Code CLI flags). The docs list:

Example:

- uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: "/review"
    claude_args: "--allowed-tools Read,Grep,Bash(git diff)"

If you’re upgrading from the old beta action inputs, the migration table notes allowed_tools moved to claude_args: --allowedTools (camelCase) (docs.anthropic.com).

For the CLI/SDK flag form (outside Actions), Anthropic’s Claude Code SDK docs show --allowedTools usage (docs.anthropic.com).

Citations:


Use the documented --allowed-tools flag with comma-separated list format.

In Claude Code GitHub Actions, the flag is --allowed-tools (kebab-case, not --allowedTools), and tools must be comma-separated in a single argument. The current multi-line format with incorrect flag name will be ignored or error, compromising tool restriction.

🛠️ Proposed fix
           claude_args: >
             --model claude-opus-4-6
-            --allowedTools
-            "Bash(gh pr comment *)"
-            "Bash(gh pr diff *)"
-            "Bash(gh pr view *)"
+            --allowed-tools "Bash(gh pr comment *),Bash(gh pr diff *),Bash(gh pr view *)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Run Claude Code Review
# GitHub Actions step outputs are strings; keep the condition below comparing against 'true'.
# Note: For pull_request events (non-fork PRs from trusted contributors), we run the review
# even when sensitive files are modified. Only fork PRs (pull_request_target) check workflows_changed.
if: |
github.event_name != 'pull_request_target' ||
steps.workflow_changes.outputs.workflows_changed != 'true'
id: claude-review
uses: anthropics/claude-code-action@1b8ee3b94104046d71fde52ec3557651ad8c0d71 # v1.0.29
env:
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's AGENTS.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr diff` to see the PR changes, then use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
claude_args: >
--model claude-opus-4-6
--allowedTools
"Bash(gh pr comment *)"
"Bash(gh pr diff *)"
"Bash(gh pr view *)"
- name: Run Claude Code Review
# GitHub Actions step outputs are strings; keep the condition below comparing against 'true'.
# Note: For pull_request events (non-fork PRs from trusted contributors), we run the review
# even when sensitive files are modified. Only fork PRs (pull_request_target) check workflows_changed.
if: |
github.event_name != 'pull_request_target' ||
steps.workflow_changes.outputs.workflows_changed != 'true'
id: claude-review
uses: anthropics/claude-code-action@1b8ee3b94104046d71fde52ec3557651ad8c0d71 # v1.0.29
env:
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's AGENTS.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr diff` to see the PR changes, then use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
claude_args: >
--model claude-opus-4-6
--allowed-tools "Bash(gh pr comment *),Bash(gh pr diff *),Bash(gh pr view *)"
🤖 Prompt for AI Agents
In @.github/workflows/claude-code-review.yml around lines 96 - 129, The
claude-review step uses an incorrect flag and format for tool restriction:
update the claude_args in the step with id "claude-review" to use the documented
kebab-case flag "--allowed-tools" and pass the tools as a single comma-separated
argument (e.g., --allowed-tools "Bash(gh pr comment *),Bash(gh pr diff
*),Bash(gh pr view *)"); ensure the flag and value remain on the same
line/argument so the action parses the allowed tools correctly.

@PeterDaveHello PeterDaveHello force-pushed the add-claude-code-review-ci-workflow branch 2 times, most recently from abaa0fb to c9ca210 Compare February 9, 2026 17:44
Copy link

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PeterDaveHello PeterDaveHello force-pushed the add-claude-code-review-ci-workflow branch 3 times, most recently from bfa45b6 to c3426dc Compare February 9, 2026 19:06
Enable Claude Code online review in GitHub Actions and limit
fork-triggered pull_request_target runs to review_requested so
maintainers explicitly gate those review runs.
@PeterDaveHello PeterDaveHello force-pushed the add-claude-code-review-ci-workflow branch from c3426dc to 094a83b Compare February 9, 2026 19:20
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.

1 participant