Skip to content

GitHub Actions Integration

Run Claude Code directly in your GitHub CI/CD pipeline. Trigger it with @claude mentions, on pull request events, on schedules, or any GitHub event.


Claude Code GitHub Actions lets Claude:

  • Respond to @claude mentions in PR and issue comments
  • Create pull requests from issue descriptions
  • Review code and leave inline comments
  • Fix bugs, implement features, run tests
  • Follow your CLAUDE.md coding standards

All while running on GitHub’s own runners — your code doesn’t leave GitHub’s infrastructure.


Run this in your terminal:

Terminal window
/install-github-app

This installs the Claude GitHub App on your repo and walks you through adding workflow files and the API key secret. You must be a repository admin to run this.


If /install-github-app fails:

  1. Install the Claude GitHub App: https://github.com/apps/claude

    • Permissions needed: Contents (read/write), Issues (read/write), Pull requests (read/write)
  2. Add your API key as a secret:

    • Go to repo Settings → Secrets → Actions
    • Add ANTHROPIC_API_KEY
  3. Copy the workflow file to .github/workflows/claude.yml


name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude:
runs-on: ubuntu-latest
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
# Automatically responds to @claude mentions in comments

After setup, tag @claude in any PR or issue comment to trigger it.


In PR or issue comments:

@claude implement this feature based on the issue description
@claude fix the TypeError in the user dashboard component
@claude how should I implement user authentication for this endpoint?
@claude review this PR for security issues

The prompt input accepts a skill invocation:

- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
plugin_marketplaces: "https://github.com/anthropics/claude-code.git"
plugins: "code-review@claude-code-plugins"
prompt: "/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}"

For skills in your own repo, run actions/checkout first and pass /skill-name.


name: Daily Report
on:
schedule:
- cron: "0 9 * * *"
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: "Generate a summary of yesterday's commits and open issues"
claude_args: "--model claude-opus-4-8"

ParameterDescriptionRequired
promptInstructions for Claude (text or skill name)No*
claude_argsCLI arguments passed to Claude CodeNo
plugin_marketplacesNewline-separated plugin marketplace Git URLsNo
pluginsNewline-separated plugin names to installNo
anthropic_api_keyClaude API keyYes**
github_tokenGitHub token for API accessNo
trigger_phraseCustom trigger phrase (default: @claude)No
use_bedrockUse Amazon Bedrock instead of Claude APINo
use_vertexUse Google Vertex AI instead of Claude APINo

* When omitted for issue/PR comments, Claude responds to trigger phrase automatically. ** Required for direct Claude API; not for Bedrock/Vertex.

Common claude_args options:

claude_args: "--max-turns 5 --model claude-sonnet-4-6 --allowedTools Bash,Edit,Read"

name: Claude PR Action
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
on:
issue_comment:
types: [created]
jobs:
claude-pr:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
env:
AWS_REGION: us-west-2
steps:
- uses: actions/checkout@v4
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Configure AWS Credentials (OIDC)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: us-west-2
- uses: anthropics/claude-code-action@v1
with:
github_token: ${{ steps.app-token.outputs.token }}
use_bedrock: "true"
claude_args: '--model us.anthropic.claude-sonnet-4-6 --max-turns 10'

Bedrock model IDs use a region prefix: us.anthropic.claude-sonnet-4-6


- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- uses: anthropics/claude-code-action@v1
with:
github_token: ${{ steps.app-token.outputs.token }}
use_vertex: "true"
claude_args: '--model claude-sonnet-4-5@20250929 --max-turns 10'
env:
ANTHROPIC_VERTEX_PROJECT_ID: ${{ steps.auth.outputs.project_id }}
CLOUD_ML_REGION: us-east5

Old Beta InputNew v1.0 Input
mode(removed — auto-detected)
direct_promptprompt
override_promptprompt with GitHub variables
custom_instructionsclaude_args: --append-system-prompt
max_turnsclaude_args: --max-turns
modelclaude_args: --model
allowed_toolsclaude_args: --allowedTools

  • GitHub Actions minutes: Claude runs on GitHub-hosted runners, consuming your Actions minutes
  • API tokens: each interaction consumes tokens based on prompt + response length
  • Optimization tips:
    • Use specific @claude commands to reduce unnecessary calls
    • Set --max-turns in claude_args to limit iterations
    • Set workflow-level timeouts
    • Use GitHub’s concurrency controls to limit parallel runs

CLAUDE.md (project-level): define coding standards, review criteria, preferred patterns. Claude reads this on every run.

prompt parameter (workflow-level): provide workflow-specific instructions.


Claude not responding: Check that the GitHub App is installed, workflows are enabled, ANTHROPIC_API_KEY is set, and comments contain @claude (not /claude).

CI not running on Claude’s commits: Ensure you’re using the GitHub App (not the Actions user). Verify workflow triggers include the necessary events.

Authentication errors: Check that API key is valid and secrets are named correctly.


  • Trick:@claude in a comment = an engineer inside your CI.”
  • Show: sandbox repo: issue comment → branch → PR, end to end.
  • They’ll trip on: missing workflow permissions (contents + pull-requests: write).

Learning path:34-routines-scheduling.md · Index · ➡ 36-code-review.md

Written by Fenil Patel