CC-201d · Module 3
GitHub Actions Integration
4 min read
The claude-code-action GitHub Action is the official bridge between Claude Code and your CI/CD pipeline. It runs Claude Code inside a GitHub Actions runner with full access to the repository, the PR context, and any secrets you configure. The most common use case — and the one you should set up first — is automated PR review.
The workflow triggers on pull_request events. When a developer opens a PR or pushes new commits, the action runs Claude Code with the diff as context. Claude reviews the changes for bugs, security issues, style violations, and architectural concerns. It posts its findings as inline PR comments — not a wall of text in a single comment, but specific comments on specific lines of code. The developer sees exactly what Claude flagged and where.
The power comes from combining the action with your project's CLAUDE.md. Claude does not review code in a vacuum — it reads your CLAUDE.md first and applies your team's specific rules, conventions, and architectural patterns. If your CLAUDE.md says "never use any in TypeScript" and a PR introduces an any type, Claude will flag it. If your CLAUDE.md says "all database queries must use parameterized statements" and a PR concatenates SQL, Claude will catch it.
This creates the compound engineering flywheel. Developer writes code, Claude reviews it using CLAUDE.md rules, developer fixes issues and optionally adds a new rule to CLAUDE.md to prevent the pattern in the future. Every PR that adds a rule to CLAUDE.md makes every subsequent review more thorough. After three months, your CLAUDE.md-powered review catches things that no static linter can — because the rules encode your team's hard-won knowledge, not just generic best practices.
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
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
review_comment_prefix: "🔍"
allowed_tools: "read,bash"
# Claude reads CLAUDE.md automatically