✻Founding-member pricing: every lesson for $19/mo. The first 3 lessons are free. Start lesson 1 →
Unit 8 · Automate Repeat Work · Lesson 35 of 40

GitHub Actions & Automated Code Review

Bring Claude Code into pull requests: install the GitHub app, configure claude-code-action, respond to @claude mentions and automate PR reviews.

ACADEMY12 min+74 XP4-question quiz

🎯 By the end of this lesson you'll be able to

  • Set up GitHub Actions with /install-github-app
  • Understand the workflow file
  • Use @claude in issues and PRs
  • Automate reviews with prompts and plugins

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:

text
/install-github-app

It 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

.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
    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

text
@claude implement this feature based on the issue description
@claude why is this test flaky? suggest a fix
@claude address the review comments above

The mention must be a complete word, and only people with write access can trigger it.

Automated reviews on every PR

yaml
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.

i
Managed Code Review

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.

!
Secrets belong in GitHub secrets

Never paste API keys into workflow files. Use ${{ secrets.ANTHROPIC_API_KEY }}, and keep workflow permissions as narrow as the job allows.

⇅Get @claude working in a repodrag or use arrows
  1. ⋮⋮Run /install-github-app inside Claude Code
  2. ⋮⋮Install the Claude GitHub app on the repository
  3. ⋮⋮Store the API key or OAuth token as a repo secret
  4. ⋮⋮Merge the PR that adds .github/workflows/claude.yml
  5. ⋮⋮Comment "@claude" on an issue and watch the action run

Check your understanding

?Lesson quiz10 XP per correct answer · +25 for a perfect score
QUESTION 1 OF 4

Which command sets up the GitHub integration from inside Claude Code?

Why: /install-github-app walks through the app, secrets and workflow.
QUESTION 2 OF 4

Without a prompt input, the action runs in which mode?

Why: No prompt means it waits for @claude mentions.
QUESTION 3 OF 4

How do you pass CLI flags like --max-turns to the action?

Why: claude_args forwards flags to Claude Code.
QUESTION 4 OF 4

Where should the API key live?

Why: Reference it as ${{ secrets.ANTHROPIC_API_KEY }}.
0 / 4 correct
Academy lesson

Unlock lesson 35 and the next 5

You've finished the free lessons. Join the Academy for $19/month to unlock every lesson, quiz, terminal simulation and puzzle, plus the final exam and your certificate of completion.

  • All 40 lessons across 9 units
  • 165+ quiz questions
  • Final exam + certificate
  • New lessons as Claude Code evolves
  • XP, streaks and badges
  • Cancel anytime

Already a member? Log in to continue.

Key takeaways

  • @claude in issues and PRs runs Claude Code in GitHub Actions.
  • /install-github-app sets up the app, secrets and workflow in one go.
  • No prompt = interactive mode; a prompt = automation mode.
  • Keep keys in secrets and permissions narrow.

Nice work. Lesson 35 done?

Mark it complete to earn +74 XP, keep your streak alive and unlock badges.

Written by Curtis Cornell from Anthropic's public Claude Code documentation. Last reviewed November 14, 2026. Claude Code changes fast; if something here differs from your version, the official docs win.

Start lesson 1 free →