Skip to main content
Claude Code integrates with GitHub Actions through the anthropics/claude-code-action action. Once set up, you can mention @claude in pull request or issue comments to trigger Claude to analyze context and act on the request.

Quick setup

The easiest way to add the workflow to a repository is with the built-in installer:
This interactive command walks you through:
1

Authenticate with GitHub

The installer checks that you are authenticated with the GitHub CLI (gh). If not, it prompts you to log in.
2

Choose a repository

Select the repository to set up, or use the current repository if you are already inside one.
3

Provide your Anthropic API key

Enter your ANTHROPIC_API_KEY. The installer stores it as a GitHub Actions secret in the selected repository using gh secret set.
4

Select workflows

Choose which workflows to install: the Claude PR assistant workflow, the Claude Code Review workflow, or both.
5

Open the pull request

The installer creates a new branch, commits the workflow file(s), and opens a browser tab with a pre-filled pull request for you to review and merge.
The workflows do not take effect until the pull request is merged into the default branch.

Available workflows

Claude PR assistant

Triggers when @claude is mentioned in a pull request comment, pull request review, issue comment, or issue body/title. Workflow file: .github/workflows/claude.yml

Claude Code Review

Runs automatically on every pull request (opened, synchronized, or reopened) and posts a code review using the code-review plugin. Workflow file: .github/workflows/claude-code-review.yml

Required secrets

The installer sets the secret automatically. To set it manually:

Required permissions

The workflow jobs request the following GitHub Actions permissions. Grant only what your use case needs:
Only users with write access to a repository can trigger the workflow by mentioning @claude. Mentions from other users are ignored.

Customizing the workflow

Custom prompt

Add a fixed prompt to the Run Claude Code step to instruct Claude regardless of what the comment says:

Restricting allowed tools

Use claude_args to limit which tools Claude can use:
You can also expand allowed tools for build/test tasks:

Restricting by PR author

To run the code review only for specific contributors, add an if condition to the job:

Restricting to specific file paths

To run the code review only when certain files change:

Security considerations

  • The ANTHROPIC_API_KEY is stored as an encrypted GitHub Actions secret and is never exposed in logs.
  • All Claude runs appear in the GitHub Actions run history for audit purposes.
  • Claude’s default tools are limited to reading and writing files and interacting with the repository (comments, branches, commits).
  • The allowed_tools / claude_args option in the workflow file controls which additional tools Claude may use.

Manual setup

If you prefer not to use the installer, you can set up the workflow manually. See the claude-code-action repository for full documentation and advanced configuration options.