-
Notifications
You must be signed in to change notification settings - Fork 116
89 lines (77 loc) · 4.03 KB
/
Copy pathclaude-code-review.yml
File metadata and controls
89 lines (77 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Claude Code Review
on:
pull_request:
types: [opened, synchronize]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"
jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code Review
id: claude-review
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 }}
EVENT ACTION: ${{ github.event.action }}
Please review this pull request and provide inline feedback using the GitHub review system.
Review focus areas:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Instructions:
${{ github.event.action == 'synchronize' && '
## SYNCHRONIZE EVENT - UPDATE EXISTING REVIEW
This is an update to an existing PR. You must:
1. Use the GitHub MCP tools to fetch your previous reviews on this PR
2. Fetch the latest PR diff and identify what has changed since your last review
3. Update your EXISTING review comments - DO NOT create a new review summary
4. Use checkboxes to track progress on previously identified issues:
- [ ] Unresolved issue
- [x] Resolved issue
5. For each previously identified issue:
- If it has been addressed: Mark the checkbox as complete [x] and add a note
- If it is still present: Keep the checkbox unchecked [ ]
- If new issues are found: Add new checkboxes [ ]
6. Update inline comments:
- Resolve or update threads that have been addressed
- Add new inline comments ONLY for new issues that require changes
- Do NOT add inline comments for positive changes or improvements
7. Keep all positive feedback in the summary section only
DO NOT create a new review from scratch. Update the existing one.' || '
## NEW REVIEW EVENT
This is a new PR or initial review. You must:
1. Use the GitHub MCP tools to fetch the PR diff
2. Create a review summary with checkboxes for any issues found:
- [ ] Issue description and location
3. Add inline comments ONLY for specific code that needs changes
4. DO NOT add inline comments for positive feedback - include positive feedback in the summary section only
5. Submit the review with event type COMMENT (not REQUEST_CHANGES) to publish as non-blocking feedback
' }}
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
claude_args: '--allowedTools "mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff,mcp__github__list_reviews,mcp__github__get_review,mcp__github__list_review_comments,mcp__github__update_review_comment,mcp__github__create_or_update_pull_request_review_comment"'