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.
What It Does
Section titled “What It Does”Claude Code GitHub Actions lets Claude:
- Respond to
@claudementions 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.mdcoding standards
All while running on GitHub’s own runners — your code doesn’t leave GitHub’s infrastructure.
Quick Setup
Section titled “Quick Setup”Run this in your terminal:
/install-github-appThis 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.
Manual Setup
Section titled “Manual Setup”If /install-github-app fails:
-
Install the Claude GitHub App: https://github.com/apps/claude
- Permissions needed: Contents (read/write), Issues (read/write), Pull requests (read/write)
-
Add your API key as a secret:
- Go to repo Settings → Secrets → Actions
- Add
ANTHROPIC_API_KEY
-
Copy the workflow file to
.github/workflows/claude.yml
Basic Workflow
Section titled “Basic Workflow”name: Claude Codeon: 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 commentsAfter setup, tag @claude in any PR or issue comment to trigger it.
Common Use Cases
Section titled “Common Use Cases”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 issuesUsing Skills in Actions
Section titled “Using Skills in Actions”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.
Scheduled Automation
Section titled “Scheduled Automation”name: Daily Reporton: 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"Action Parameters (v1)
Section titled “Action Parameters (v1)”| Parameter | Description | Required |
|---|---|---|
prompt | Instructions for Claude (text or skill name) | No* |
claude_args | CLI arguments passed to Claude Code | No |
plugin_marketplaces | Newline-separated plugin marketplace Git URLs | No |
plugins | Newline-separated plugin names to install | No |
anthropic_api_key | Claude API key | Yes** |
github_token | GitHub token for API access | No |
trigger_phrase | Custom trigger phrase (default: @claude) | No |
use_bedrock | Use Amazon Bedrock instead of Claude API | No |
use_vertex | Use Google Vertex AI instead of Claude API | No |
* 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"Enterprise: Amazon Bedrock
Section titled “Enterprise: Amazon Bedrock”name: Claude PR Actionpermissions: 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
Enterprise: Google Vertex AI
Section titled “Enterprise: Google Vertex AI” - 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-east5Upgrading from Beta to v1
Section titled “Upgrading from Beta to v1”| Old Beta Input | New v1.0 Input |
|---|---|
mode | (removed — auto-detected) |
direct_prompt | prompt |
override_prompt | prompt with GitHub variables |
custom_instructions | claude_args: --append-system-prompt |
max_turns | claude_args: --max-turns |
model | claude_args: --model |
allowed_tools | claude_args: --allowedTools |
Cost Considerations
Section titled “Cost Considerations”- 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
@claudecommands to reduce unnecessary calls - Set
--max-turnsinclaude_argsto limit iterations - Set workflow-level timeouts
- Use GitHub’s concurrency controls to limit parallel runs
- Use specific
Customizing Behavior
Section titled “Customizing Behavior”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.
Troubleshooting
Section titled “Troubleshooting”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.
Related
Section titled “Related”- Routines — cloud-based scheduled automation
- GitLab CI/CD — same concept for GitLab
- Agent SDK — build custom agents beyond GitHub Actions
🧠 Quick Recall
Section titled “🧠 Quick Recall”- Trick: “
@claudein a comment = an engineer inside your CI.”
👨🏫 Teach It
Section titled “👨🏫 Teach It”- 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