-
Notifications
You must be signed in to change notification settings - Fork 45
70 lines (62 loc) · 2 KB
/
claude-review.yml
File metadata and controls
70 lines (62 loc) · 2 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
name: Claude PR Review
on:
issue_comment:
types: [created]
jobs:
review:
if: >
github.event.issue.pull_request &&
contains(github.event.comment.body, '/claude review')
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pyyaml
- name: Install Claude Code
run: npm install -g @anthropic-ai/claude-code
- name: Get PR diff
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER="${{ github.event.issue.number }}"
gh pr diff "$PR_NUMBER" > /tmp/pr-diff.patch
- name: Run reviewers
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
REVIEW_MODE: plain
run: |
chmod +x .claude/reviewers/run-review.sh
.claude/reviewers/run-review.sh /tmp/pr-diff.patch > /tmp/review-output.txt 2>&1
- name: Post review comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER="${{ github.event.issue.number }}"
# Truncate if too long for a GH comment (max ~65536 chars)
head -c 60000 /tmp/review-output.txt > /tmp/review-truncated.txt
# Build comment body
{
echo '## Claude PR Review'
echo ''
echo '<details>'
echo '<summary>Review results (click to expand)</summary>'
echo ''
echo '```'
cat /tmp/review-truncated.txt
echo '```'
echo ''
echo '</details>'
echo ''
echo '*Triggered by `/claude review` — running in plain mode (no GPU).*'
} > /tmp/review-comment.md
gh pr comment "$PR_NUMBER" --body-file /tmp/review-comment.md