CI integration lets Claude triage issues, review pull requests and fix bugs where your team already works.
GitHub Actions is GitHub's built-in automation: YAML files in .github/workflows/ describe jobs that run on events such as a new comment or pull request. The Claude Code GitHub Action (anthropics/claude-code-action) runs Claude Code inside such a job.
Quick setup: run /install-github-app in Claude Code inside the repository (you need admin rights and the gh CLI). It installs the Claude GitHub App, stores a secret, and opens a pull request adding the workflow. Manual setup is the same three steps by hand: install the app, add a repository secret (ANTHROPIC_API_KEY, or CLAUDE_CODE_OAUTH_TOKEN from claude setup-token for a subscription), and copy the example workflow.
Two modes, chosen by your workflow:
- Interactive: no
promptinput. Claude waits for@claudein an issue or PR comment ("@claude fix the TypeError in the dashboard") and replies in a comment, pushing commits if asked. - Automation: a
promptinput (plain text or a/skill) runs on any event, such as each new PR or a nightly schedule.
claude_args passes CLI flags: --max-turns, --model, --allowedTools, --mcp-config. By default the action only lets users with write access trigger it and rejects bots, to prevent loops and abuse.
Good practice:
- keep secrets in GitHub Secrets, never in the repo,
- grant the workflow only the
permissionsit needs, - put review criteria and conventions in CLAUDE.md, which the action reads,
- cap work with
--max-turnsand job timeouts; each run uses Actions minutes and tokens, - review Claude's PRs like any other contributor's.
Example
# .github/workflows/claude.yml
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- uses: actions/checkout@v6
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: "--max-turns 10"Remember
- /install-github-app sets up the app, secret and workflow for you
- No prompt = respond to @claude; a prompt = run automatically on events
- Pass CLI flags via claude_args; keep secrets in GitHub Secrets and cap turns
Watch out for
- Hard-coding an API key in the workflow file instead of referencing a repository secret.