The anthropics/claude-code-action@v1 GitHub Action runs a full Claude Code runtime inside any standard GitHub Actions runner, giving your team automated PR reviews, CI failure auto-fixes, and interactive @claude comment triggers — all for under $5/month on most repositories.
The Review Capacity Crisis Driving AI Adoption in 2026
Review capacity, not development speed, now limits delivery velocity — and that is the primary bottleneck facing engineering teams in 2026. Zylos Research found that 84% of developers regularly use AI-assisted coding tools and that 41% of all commits are AI-assisted. The natural next step is closing the loop: if AI is generating code, AI should also review it. The AI code review market is projected to reach $750M with a 9.2% CAGR through 2033, and 20% of companies already use AI to review 10–20% of their PRs, with that share expected to grow sharply through the year. Teams that don’t automate review risk creating a two-speed pipeline — AI-pace code generation feeding into human-pace review queues. Claude Code GitHub Actions eliminates that mismatch by inserting a capable, configurable AI reviewer at every pull request boundary, scaling review throughput without scaling headcount.
What Is anthropics/claude-code-action@v1?
anthropics/claude-code-action@v1 is the official Anthropic GitHub Action that runs the full Claude Code runtime inside a standard GitHub Actions runner. Launched as part of Claude Code 2.0 on September 29, 2025 and built on Anthropic’s Agent SDK, the action supports two operating modes that are now auto-detected — no explicit mode: tag required. In interactive mode, the action wakes when a developer mentions @claude in a PR comment and responds inline. In automation mode, the action runs headlessly on a schedule or trigger using the prompt parameter in your workflow YAML. The action connects to Claude via four authentication backends: Anthropic API direct, Claude Code OAuth (Max plan), AWS Bedrock OIDC, and Google Vertex AI OIDC. The key parameters are anthropic_api_key (required unless using OAuth), prompt (optional; omit for comment-trigger mode), claude_args (pass-through to the CLI), and trigger_phrase (default @claude). Unlike simpler actions that just call the Chat API, this runs the full Code agent — it can read files, run tests, push commits, and open PRs.
Quick Setup: Three Paths to Get Started
Getting started with Claude Code GitHub Actions takes under ten minutes on any of three paths. The fastest path is running /install-github-app inside the Claude Code terminal — it installs the GitHub App, configures secrets, and creates a starter workflow automatically. The manual path requires adding ANTHROPIC_API_KEY to your repository’s GitHub Secrets (Settings → Secrets → Actions → New repository secret) and creating a workflow file in .github/workflows/. The OAuth path uses a Claude Max plan token instead of an API key, which is useful for teams that want billing through the Max subscription rather than pay-per-token. Private repositories work identically — the action requires pull-requests: write permission in the workflow’s permissions: block. The starter workflow below covers 90% of teams getting started:
name: Claude Code Review
on:
pull_request:
types: [opened, synchronize]
issue_comment:
types: [created]
permissions:
pull-requests: write
contents: read
jobs:
claude-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
The Four Core Workflow Patterns
There are four workflow patterns that cover nearly every CI use case teams encounter when integrating Claude Code with GitHub. Understanding all four before picking one saves you from wiring the wrong trigger and wasting tokens. Each pattern targets a distinct moment in the development lifecycle: ad-hoc developer questions, systematic pre-triage of every PR, recovering from broken CI, and generating structured data to gate downstream steps. Groundy’s 2026 guide identifies these as the canonical set after analyzing hundreds of production deployments built on claude-code-action@v1. Most teams start with Pattern 2 (automated PR review), add Pattern 1 (interactive comments) once they see developers actually using @claude mentions, and graduate to Pattern 3 (CI auto-fix) after they trust the agent’s judgment on their codebase. Pattern 4 is for teams with more mature pipelines that need machine-readable quality gates, not just human-readable comments. Choosing the right entry point saves several hours of misconfigured trial runs and avoids the common mistake of deploying Pattern 3 before establishing baseline trust in the model’s review quality on your specific codebase.
Pattern 1: Interactive @claude Comment Trigger
The interactive trigger fires when any pull request comment contains the phrase @claude. The action reads the comment, loads the diff, and replies inline. Use this for ad-hoc requests: “@claude can you explain why we’re using a mutex here?” or “@claude rewrite this function to handle the null case.” The trigger_phrase parameter defaults to @claude but can be changed to avoid conflicts with GitHub user handles. Keep prompt out of the YAML for this pattern — the comment text becomes the prompt.
on:
issue_comment:
types: [created]
Pattern 2: Automated PR Code Review
Automated review runs on every PR open and push. Add a prompt parameter with your team’s review standards, and every PR gets pre-triaged before a human looks at it. Setting post_as_review: true submits a formal GitHub PR Review — it appears in the approvals section, not just as a comment. The review_event parameter accepts COMMENT, APPROVE, or REQUEST_CHANGES.
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Review this pull request for: correctness, security vulnerabilities,
test coverage gaps, and adherence to our style guide in CLAUDE.md.
Be direct and specific. Flag blockers clearly.
post_as_review: "true"
review_event: "COMMENT"
The system_prompt parameter is the highest-leverage config option for teams. Write your standards once — naming conventions, forbidden patterns, required test coverage thresholds — and every PR review inherits them automatically.
Pattern 3: CI Failure Auto-Fix
CI failure auto-fix is the highest-impact pattern and the most compelling demonstration of what differentiates this action from simpler AI review tools. When CI fails, Claude diagnoses the failure, creates a fix branch, pushes a patch, and opens a PR for human review — all without human intervention. The critical implementation detail is the loop prevention guard: use an if: condition to exclude Claude’s own fix branches from triggering new fix attempts, or you’ll create an infinite loop.
name: Auto-Fix CI Failures
on:
workflow_run:
workflows: ["CI"]
types: [completed]
jobs:
auto-fix:
if: >
github.event.workflow_run.conclusion == 'failure' &&
!startsWith(github.event.workflow_run.head_branch, 'claude-fix/')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
CI failed on branch ${{ github.event.workflow_run.head_branch }}.
Diagnose the failure, fix the root cause, commit on a new branch
named claude-fix/${{ github.run_id }}, and open a PR.
claude_args: "--max-turns 10"
Pattern 4: Structured Output for Downstream Decisions
Pattern 4 generates machine-readable JSON from Claude’s review, which downstream steps can parse to gate deployments or update dashboards. Instruct Claude to output only JSON in the prompt, then use jq or Python to extract fields. This pattern is overkill for most teams but indispensable for compliance pipelines that need auditable, structured quality gates.
Cost Optimization: Path Filtering, Concurrency, and Token Budgets
Claude Sonnet 4 costs $3/MTok input and $15/MTok output. A 400-line diff typically runs under $0.05 per review. For a team of 10 engineers merging 20 PRs/day, costs run approximately $24/month — and most teams running 50 PRs/month see under $5/month. Three levers control costs:
Path filtering is the highest-impact optimization. Add paths: to your trigger to skip lock files, auto-generated code, and docs-only changes. This saves 30–50% on token costs immediately.
on:
pull_request:
paths:
- "src/**"
- "lib/**"
- "!**/*.lock"
- "!**/generated/**"
Concurrency groups prevent parallel review jobs from stacking up on rapid pushes:
concurrency:
group: claude-review-${{ github.ref }}
cancel-in-progress: true
--max-turns caps the agent’s iteration count. For review-only workflows, --max-turns 3 is plenty. For CI auto-fix, --max-turns 10 gives the agent enough room to diagnose and patch without running indefinitely.
Security Guardrails: Loop Prevention, Permissions, and CLAUDE.md
Three security practices are non-negotiable for production deployments. First, never commit API keys — use GitHub Secrets exclusively. Second, scope permissions to the minimum necessary: a review-only job needs only pull-requests: write and contents: read; an auto-fix job additionally needs contents: write. Third, use CLAUDE.md to constrain behavior: place a CLAUDE.md at the repository root with explicit behavioral limits — which files the agent may not modify, which commands it may not run, and which review standards apply. Claude Code reads CLAUDE.md automatically on every run, making it the most reliable way to enforce team conventions without repeating them in every workflow YAML.
The loop prevention guard for CI auto-fix belongs in every production deployment:
if: >
!startsWith(github.event.workflow_run.head_branch, 'claude-fix/') &&
!contains(github.actor, '[bot]')
Enterprise Deployment: AWS Bedrock and Google Vertex AI
For organizations with data residency requirements or enterprise procurement constraints, the action supports AWS Bedrock and Google Vertex AI as authentication backends via OIDC — no direct Anthropic billing required. Configure AWS Bedrock by setting use_bedrock: true and providing the appropriate OIDC role and region. Configure Google Vertex AI with use_vertex: true plus your project and region. Both paths require the GitHub OIDC token permission (id-token: write) in the workflow’s permissions: block. Enterprise deployments using Bedrock or Vertex bypass the Anthropic API rate limits that can affect high-volume teams and get the same model quality with their existing cloud provider billing relationships.
| Auth Backend | Billing | Data Residency | Setup Complexity |
|---|---|---|---|
| Anthropic API | Pay-per-token | US (default) | Low |
| Claude Max OAuth | Subscription | US | Low |
| AWS Bedrock OIDC | AWS billing | Your region | Medium |
| Google Vertex OIDC | GCP billing | Your region | Medium |
The State of AI Code Review in 2026
The numbers are unambiguous: AI code review delivers a 5:1 ROI, with teams reporting 300% return on subscription costs within six months and estimated annual savings of $250K for a 50-developer organization. Leading AI code review tools detect 42–48% of real-world runtime bugs with 85–95% overall accuracy and a 5–15% false positive rate. Code assistant adoption grew from 49.2% in January 2025 to 69% in October 2025 (peaking at 72.8% in August 2025). GitHub handles 82M+ pushes and 43M+ merged PRs per month — the scale at which manual review genuinely cannot keep pace. The industry has evolved from simple line-by-line analysis to agent-based, cross-repository review. Claude Code GitHub Actions is squarely in that second generation: it reasons about intent, not just syntax, and can act on what it finds rather than just flagging it.
Troubleshooting Common Issues
Auth errors (ANTHROPIC_API_KEY not found): Confirm the secret name matches exactly — GitHub Secrets are case-sensitive. Confirm the workflow’s env: or with: block references ${{ secrets.ANTHROPIC_API_KEY }}, not a hardcoded string.
Missing pull-requests: write permission: The action cannot post comments or submit reviews without this. Add it to the permissions: block at the job level, not just the workflow level.
Loop prevention not working: Ensure your if: condition uses startsWith on the branch name, not a substring match. Claude’s fix branches use the claude-fix/ prefix by default.
Review posts as a comment, not a formal review: Set post_as_review: "true" (string, not boolean) in the action’s with: block.
High token costs on large PRs: Add path filtering to the trigger and set --max-turns in claude_args. Review the system_prompt for unnecessary verbosity — shorter, more specific prompts cost less.
Best Practices: System Prompts, Review Standards, and Team Conventions
The system_prompt parameter is where teams get the most leverage per configuration hour invested. A well-written system prompt does three things: defines what good looks like (not just what bad looks like), scopes the review to what the team actually cares about (security? test coverage? API design?), and sets the tone (harsh gate vs. collaborative suggestion). Start specific and loosen over time as you observe false positives.
Put your review standards in CLAUDE.md rather than inline YAML — this keeps the source of truth version-controlled with the code it governs, visible to developers, and automatically loaded by every Claude Code session (local and CI). Use headings to separate concerns: ## Security Review Standards, ## Testing Requirements, ## Off-Limits Files.
For teams new to AI review, start with review_event: "COMMENT" rather than REQUEST_CHANGES — this gives developers time to calibrate their trust in the AI’s judgment before it starts blocking merges.
FAQ
Do I need a Claude Max plan to use Claude Code GitHub Actions? No. The action works with a standard Anthropic API key on any plan. A Claude Max OAuth token is an option for teams that prefer subscription billing, but it is not required.
Can Claude Code GitHub Actions push commits directly to my main branch? Not unless you explicitly configure it to. The CI auto-fix pattern creates a new branch and opens a PR — it does not push to protected branches. You retain full merge control.
How does anthropics/claude-code-action@v1 differ from the old v0 action?
In v1, mode is auto-detected (no more mode: tag), direct_prompt was renamed to prompt, and CLI options moved from dedicated parameters to claude_args. Any v0 workflow needs these three changes before upgrading.
What happens if Claude’s auto-fix PR is also broken?
The loop prevention guard (!startsWith(branch, 'claude-fix/')) prevents the action from triggering on its own fix branch. A broken fix PR shows up in your queue as any other PR — a human reviews and merges or closes it.
Is this safe to run on public repositories?
Yes, with caution. The primary risk on public repos is prompt injection via malicious PR content. Scope the action’s GitHub token permissions to the minimum necessary, and consider restricting the trigger to PRs from team members only using a if: github.event.pull_request.author_association == 'MEMBER' guard.
