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:Authenticate with GitHub
The installer checks that you are authenticated with the GitHub CLI (
gh). If not, it prompts you to log in.Choose a repository
Select the repository to set up, or use the current repository if you are already inside one.
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.Select workflows
Choose which workflows to install: the Claude PR assistant workflow, the Claude Code Review workflow, or both.
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 thecode-review plugin.
Workflow file: .github/workflows/claude-code-review.yml
Required secrets
| Secret | Description |
|---|---|
ANTHROPIC_API_KEY | Your Anthropic API key. Set this as a GitHub Actions repository secret. |
CLAUDE_CODE_OAUTH_TOKEN | Alternative to ANTHROPIC_API_KEY when using OAuth authentication. |
Required permissions
The workflow jobs request the following GitHub Actions permissions. Grant only what your use case needs:| Permission | Level | Purpose |
|---|---|---|
contents | read | Read repository files and history |
pull-requests | read | Read PR diffs and comments |
issues | read | Read issue body and comments |
id-token | write | OIDC token (used for authentication) |
actions | read | Read CI results on PRs |
Customizing the workflow
Custom prompt
Add a fixed prompt to theRun Claude Code step to instruct Claude regardless of what the comment says:
Restricting allowed tools
Useclaude_args to limit which tools Claude can use:
Restricting by PR author
To run the code review only for specific contributors, add anif condition to the job:
Restricting to specific file paths
To run the code review only when certain files change:Security considerations
- The
ANTHROPIC_API_KEYis 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_argsoption in the workflow file controls which additional tools Claude may use.