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 →
When a new issue is opened, Claude searches existing issues for duplicates. If it finds one, it comments with a link and applies a duplicate label.
issues: opened
How it works
Setup
.github/workflows/claude-code-action-issue-deduplication.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 "Issue deduplication: Claude finds and flags duplicate issues" GitHub workflow from AgentFlows (https://agentflows.sh/flows/claude-code-action-issue-deduplication) so it runs on my Claude Pro or Max subscription instead of API credits.
Save this file as .github/workflows/claude-code-action-issue-deduplication.yml:
```yaml
name: Issue Deduplication
on:
issues:
types: [opened]
jobs:
deduplicate:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Check for duplicate issues
uses: anthropics/claude-code-action@v1
with:
prompt: |
Analyze this new issue and check if it's a duplicate of existing issues in the repository.
Issue: #${{ github.event.issue.number }}
Repository: ${{ github.repository }}
Your task:
1. Use mcp__github__get_issue to get details of the current issue (#${{ github.event.issue.number }})
2. Search for similar existing issues using mcp__github__search_issues with relevant keywords from the issue title and body
3. Compare the new issue with existing ones to identify potential duplicates
Criteria for duplicates:
- Same bug or error being reported
- Same feature request (even if worded differently)
- Same question being asked
- Issues describing the same root problem
If you find duplicates:
- Add a comment on the new issue linking to the original issue(s)
- Apply a "duplicate" label to the new issue
- Be polite and explain why it's a duplicate
- Suggest the user follow the original issue for updates
If it's NOT a duplicate:
- Don't add any comments
- You may apply appropriate topic labels based on the issue content
Use these tools:
- mcp__github__get_issue: Get issue details
- mcp__github__search_issues: Search for similar issues
- mcp__github__list_issues: List recent issues if needed
- mcp__github__create_issue_comment: Add a comment if duplicate found
- mcp__github__update_issue: Add labels
Be thorough but efficient. Focus on finding true duplicates, not just similar issues.
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: |
--allowedTools "mcp__github__get_issue,mcp__github__search_issues,mcp__github__list_issues,mcp__github__create_issue_comment,mcp__github__update_issue,mcp__github__get_issue_comments"
```
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: issues: opened. 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-issue-deduplication.yml
Name
The name GitHub shows in the Actions tab. The file path is under Where to paste this.
name: Issue DeduplicationTrigger
GitHub starts a run when an issue is opened.
on: issues: types: [opened]Jobs
Each job is one runner. The steps inside it run top to bottom.
jobs: deduplicate: runs-on: ubuntu-latest timeout-minutes: 10Permissions
This token may read the repo, comment on issues and change labels, and request a GitHub OIDC token. Anything not listed is not granted.
permissions: contents: read issues: write id-token: writeSteps
These steps run in order on that job.
steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 1 - name: Check for duplicate issuesAgent
Runs Claude Code with anthropics/claude-code-action@v1. Inputs: prompt (the task); anthropic_api_key (the Claude API key secret); claude_args (Claude Code flags, including allowed tools).
uses: anthropics/claude-code-action@v1 with: prompt: | Analyze this new issue and check if it's a duplicate of existing issues in the repository. Issue: #${{ github.event.issue.number }} Repository: ${{ github.repository }} Your task: 1. Use mcp__github__get_issue to get details of the current issue (#${{ github.event.issue.number }}) 2. Search for similar existing issues using mcp__github__search_issues with relevant keywords from the issue title and body 3. Compare the new issue with existing ones to identify potential duplicates Criteria for duplicates: - Same bug or error being reported - Same feature request (even if worded differently) - Same question being asked - Issues describing the same root problem If you find duplicates: - Add a comment on the new issue linking to the original issue(s) - Apply a "duplicate" label to the new issue - Be polite and explain why it's a duplicate - Suggest the user follow the original issue for updates If it's NOT a duplicate: - Don't add any comments - You may apply appropriate topic labels based on the issue content Use these tools: - mcp__github__get_issue: Get issue details - mcp__github__search_issues: Search for similar issues - mcp__github__list_issues: List recent issues if needed - mcp__github__create_issue_comment: Add a comment if duplicate found - mcp__github__update_issue: Add labels Be thorough but efficient. Focus on finding true duplicates, not just similar issues. anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} claude_args: | --allowedTools "mcp__github__get_issue,mcp__github__search_issues,mcp__github__list_issues,mcp__github__create_issue_comment,mcp__github__update_issue,mcp__github__get_issue_comments"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