Claude auto PR review
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executedJust shippedOur pick for the best security, implementation, and planning skills.Best skills for each job.See the picks →
Runs a Claude PR review only for pull requests from authors you list, for example external contributors. Everyone else's PRs are skipped.
pull_request: opened, synchronize (selected authors only)
How it works
Setup
.github/workflows/claude-code-action-pr-review-filtered-authors.ymlANTHROPIC_API_KEY. The file reads it as secrets.NAME. Do not paste the key into the YAML.Let your agent do it
Paste it into your coding agent in this repo. It does the setup and asks before anything leaves your machine.
Runs in GitHub Actions on your Claude Pro or Max plan through an OAuth token from claude setup-token. No API credits.
Set up the "PR review only for selected authors (e.g. external contributors)" GitHub workflow from AgentFlows (https://agentflows.sh/flows/claude-code-action-pr-review-filtered-authors) so it runs on my Claude Pro or Max subscription instead of API credits.
Install these agent skills first. Download each SKILL.md from its source (respect its license) into .claude/skills/<name>/SKILL.md, or wherever this agent loads skills from:
- Code review: https://github.com/anthropics/knowledge-work-plugins/blob/main/engineering/skills/code-review/SKILL.md (Apache-2.0), notes at https://agentflows.sh/skills/code-review
Save this file as .github/workflows/claude-code-action-pr-review-filtered-authors.yml:
```yaml
name: Claude Review - Specific Authors
on:
pull_request:
types: [opened, synchronize]
jobs:
review-by-author:
# Only run for PRs from specific authors
if: |
github.event.pull_request.user.login == 'developer1' ||
github.event.pull_request.user.login == 'developer2' ||
github.event.pull_request.user.login == 'external-contributor'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Review PR from Specific Author
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Please provide a thorough review of this pull request.
Note: The PR branch is already checked out in the current working directory.
Since this is from a specific author that requires careful review,
please pay extra attention to:
- Adherence to project coding standards
- Proper error handling
- Security best practices
- Test coverage
- Documentation
Provide detailed feedback and suggestions for improvement.
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"
```
It authenticates with CLAUDE_CODE_OAUTH_TOKEN. Tell me to run `claude setup-token` in my own terminal to create it, then run `gh secret set CLAUDE_CODE_OAUTH_TOKEN` and let me paste it. Never write the token into a file.
It runs on: pull_request: opened, synchronize (selected authors only). Runs count against my subscription's usage limits, and GitHub Actions minutes still apply.
Show me the diff, then commit on a new branch and open a pull request.The file
Copy the file as-is. The notes beside each block explain it.
.github/workflows/claude-code-action-pr-review-filtered-authors.yml
Name
The name GitHub shows in the Actions tab. The file path is under Where to paste this.
name: Claude Review - Specific AuthorsTrigger
GitHub starts a run when a pull request is opened or updated with new commits.
on: pull_request: types: [opened, synchronize]Jobs
Each job is one runner. The steps inside it run top to bottom.
jobs: review-by-author: # Only run for PRs from specific authors if: | github.event.pull_request.user.login == 'developer1' || github.event.pull_request.user.login == 'developer2' || github.event.pull_request.user.login == 'external-contributor' runs-on: ubuntu-latestPermissions
This token may read the repo, read pull requests, and request a GitHub OIDC token. Anything not listed is not granted.
permissions: contents: read pull-requests: read id-token: writeSteps
These steps run in order on that job.
steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 1 - name: Review PR from Specific AuthorAgent
Runs Claude Code with anthropics/claude-code-action@v1. Inputs: anthropic_api_key (the Claude API key secret); prompt (the task); claude_args (Claude Code flags, including allowed tools).
uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} prompt: | REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }} Please provide a thorough review of this pull request. Note: The PR branch is already checked out in the current working directory. Since this is from a specific author that requires careful review, please pay extra attention to: - Adherence to project coding standards - Proper error handling - Security best practices - Test coverage - Documentation Provide detailed feedback and suggestions for improvement. claude_args: | --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"Keep going
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executed`track_progress: true` posts a checkbox tracking comment (per Solutions Guide).
pull_request: opened, synchronize, ready_for_review, reopened
Est. cost per run~$0.22Checked Oct 16, 2026
Not executedNo `prompt` → the action runs in tag/interactive mode and responds to the comment. `trigger_phrase` default is `@claude` (usage.md).
issue_comment / pull_request_review_comment containing @claude
Est. cost per run~$0.27Checked Oct 16, 2026
Not executed· 1 caveat