forked from ChrisWiles/claude-code-showcase
-
Notifications
You must be signed in to change notification settings - Fork 11
75 lines (66 loc) · 2.57 KB
/
pr-claude-code-review.yml
File metadata and controls
75 lines (66 loc) · 2.57 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
name: PR - Claude Code Review
on:
pull_request:
types: [opened, synchronize, reopened]
issue_comment:
types: [created]
concurrency:
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
issues: read
jobs:
review:
# Run on PR events, or on issue comments that mention @claude
if: |
github.event_name == 'pull_request' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@claude'))
runs-on: ubuntu-latest
steps:
- name: Checkout repository (PR event)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Checkout repository (issue_comment event)
if: github.event_name == 'issue_comment'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout PR branch (issue_comment event)
if: github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr checkout ${{ github.event.issue.number }}
- name: Get PR base branch
id: pr-info
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "base_ref=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
else
BASE_REF=$(gh pr view ${{ github.event.issue.number }} --json baseRefName -q '.baseRefName')
echo "base_ref=$BASE_REF" >> $GITHUB_OUTPUT
fi
- name: Claude Code Review
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
model: claude-opus-4-5-20251101
timeout_minutes: 30
track_progress: true
prompt: |
Review this Pull Request using the standards in .claude/agents/code-reviewer.md
1. Read .claude/agents/code-reviewer.md for the full checklist
2. Run `git diff origin/${{ steps.pr-info.outputs.base_ref }}...HEAD` to see changes
3. Apply the review checklist to modified files
4. Provide feedback organized by severity (Critical, Warning, Suggestion)
claude_args: |
--max-turns 10
--allowedTools "Read,Glob,Grep,Bash(git:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"