11name : Claude Code Review
22
33on :
4+ # Same-repo branches: full access to secrets and write permissions
5+ pull_request :
6+ types : [opened, synchronize, ready_for_review, reopened]
7+ # Fork PRs: runs in base repo context with secrets access
48 pull_request_target :
59 types : [opened, synchronize, ready_for_review, reopened]
6- # Optional: Only run on specific file changes
7- # paths:
8- # - "src/**/*.ts"
9- # - "src/**/*.tsx"
10- # - "src/**/*.js"
11- # - "src/**/*.jsx"
1210
1311jobs :
1412 claude-review :
15- # Optional: Filter by PR author
16- # if: |
17- # github.event.pull_request.user.login == 'external-contributor' ||
18- # github.event.pull_request.user.login == 'new-developer' ||
19- # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
13+ # Avoid duplicate runs: use pull_request for same-repo, pull_request_target for forks
14+ if : |
15+ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) &&
16+ !(github.event_name == 'pull_request_target' && !github.event.pull_request.head.repo.fork)
2117 runs-on : ubuntu-latest
2218 permissions :
2319 contents : read
2420 pull-requests : write
2521 issues : read
2622 id-token : write
23+ actions : read
2724
2825 steps :
2926 - name : Checkout repository
3027 uses : actions/checkout@v4
3128 with :
29+ ref : ${{ github.event.pull_request.head.sha }}
3230 fetch-depth : 1
3331
3432 - name : Run Claude Code Review
@@ -37,10 +35,27 @@ jobs:
3735 with :
3836 claude_code_oauth_token : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3937 github_token : ${{ secrets.GITHUB_TOKEN }}
40- use_sticky_comment : true
41- plugin_marketplaces : ' https://github.com/anthropics/claude-code.git'
42- plugins : ' code-review@claude-code-plugins'
43- prompt : ' /code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
44- # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
45- # or https://code.claude.com/docs/en/cli-reference for available options
38+ additional_permissions : |
39+ actions: read
40+ prompt : |
41+ REPO: ${{ github.repository }}
42+ PR NUMBER: ${{ github.event.pull_request.number }}
43+
44+ Review this pull request thoroughly. For each issue found:
45+
46+ 1. Classify severity: critical, important, or suggestion
47+ 2. For critical and important issues: describe exactly what needs to change
48+ 3. For suggestions: only mention if they clearly improve code quality
49+
50+ Follow the project's code style: ruff formatting, Google-style docstrings,
51+ 127-char line length, PEP 8. Check for correctness, test coverage, and
52+ backward compatibility.
53+
54+ Do not flag stylistic preferences or false positives.
55+
56+ Use `gh pr comment` for top-level feedback summary.
57+ Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues.
58+ Only post GitHub comments; do not submit review text as messages.
4659
60+ claude_args : |
61+ --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Read,Glob,Grep"
0 commit comments