CC-201c · Module 3

GitHub Actions for Claude

4 min read

Claude Code in a GitHub Action is Claude without a human at the keyboard. It runs in CI, triggered by events — pull request opened, issue created, comment posted — and performs tasks autonomously. The claude-code-action from Anthropic is the official integration. It gives Claude access to the repository, the PR diff, issue context, and the ability to post comments, request changes, and even push commits. This is not a toy integration. Anthropic's own engineering team uses it on every pull request.

The setup is straightforward. Add a GitHub Action workflow that triggers on pull_request and issue_comment events. Configure it with your Anthropic API key as a repository secret. Point it at the claude-code-action. When a PR is opened, Claude reviews the diff. When someone tags @claude in a comment, Claude responds. When an issue is created with a specific label, Claude triages it. Each trigger is an entry point for autonomous Claude work that runs without any developer opening a terminal.

The CLAUDE.md in your repository is the instruction set for CI Claude. Everything you put in that file — coding standards, architectural rules, naming conventions, test requirements — becomes the review criteria that Claude applies to every PR. This is why maintaining a high-quality CLAUDE.md matters beyond your local development experience. It is the quality gate for your entire CI pipeline. A well-maintained CLAUDE.md means every PR gets a consistent, thorough review against your team's actual standards.

name: Claude Code Review
on:
  pull_request:
    types: [opened, synchronize]
  issue_comment:
    types: [created]

jobs:
  review:
    if: |
      github.event_name == 'pull_request' ||
      contains(github.event.comment.body, '@claude')
    runs-on: ubuntu-latest
    steps:
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}