Claude in your pull requests
With the GitHub integration, anyone on your team can mention @claude in an issue or PR comment, and Claude Code runs in GitHub Actions to answer questions, implement features or fix review comments, then pushes commits for review.
Quick setup
Inside Claude Code, in your repo:
/install-github-appIt walks you through installing the Claude GitHub app, saving your API key or OAuth token as a repository secret and opening a PR with the workflow file. You'll need admin access to the repo and the gh CLI signed in.
The workflow file
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
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}With no prompt input, the action runs in interactive mode and responds to @claude mentions. Add a prompt and it runs in automation mode, for example on a schedule or on every new PR.
Using @claude
@claude implement this feature based on the issue description
@claude why is this test flaky? suggest a fix
@claude address the review comments aboveThe mention must be a complete word, and only people with write access can trigger it.
Automated reviews on every PR
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
permissions: { contents: read, pull-requests: write, id-token: write }
steps:
- uses: actions/checkout@v6
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: "Review this PR for correctness and security only. Comment inline. Skip style."
claude_args: "--max-turns 8"claude_args passes any CLI flags (model, max turns, MCP config) through to Claude Code.
On Team and Enterprise plans, Anthropic also offers managed Code Review that reviews PRs and comments inline without you maintaining a workflow. Tune what it flags with a REVIEW.md file, and request a review by commenting @claude review.
Never paste API keys into workflow files. Use ${{ secrets.ANTHROPIC_API_KEY }}, and keep workflow permissions as narrow as the job allows.
- ⋮⋮Run /install-github-app inside Claude Code
- ⋮⋮Install the Claude GitHub app on the repository
- ⋮⋮Store the API key or OAuth token as a repo secret
- ⋮⋮Merge the PR that adds .github/workflows/claude.yml
- ⋮⋮Comment "@claude" on an issue and watch the action run
Check your understanding
Which command sets up the GitHub integration from inside Claude Code?
Without a prompt input, the action runs in which mode?
How do you pass CLI flags like --max-turns to the action?
Where should the API key live?