-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (68 loc) · 2.69 KB
/
claude-pr-review.yaml
File metadata and controls
77 lines (68 loc) · 2.69 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
name: Claude PR Review
on:
workflow_call:
inputs:
review_prompt:
description: Extra instructions for the review (optional).
required: false
type: string
default: None
secrets:
OP_SERVICE_ACCOUNT_TOKEN:
required: true
concurrency:
group: ${{ github.repository }}-claude-pr-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
review:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
id-token: write
pull-requests: write
steps:
- name: checkout repo
uses: actions/checkout@v6.0.1
with:
fetch-depth: 1
- name: load 1pass
id: load-1pass
uses: 1password/load-secrets-action@v3.1.0
env:
OP_SERVICE_ACCOUNT_TOKEN: "${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}"
ANTHROPIC_API_KEY: "op://GitHub Actions/common/CLAUDE_API_KEY"
- name: pr review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: "${{ steps.load-1pass.outputs.ANTHROPIC_API_KEY }}"
track_progress: true
use_sticky_comment: true
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
You are an automated PR reviewer:
- Prefer INLINE review comments with actionable fixes.
- Avoid long PR summaries.
- Only comment when you are confident it's a real issue (bug, security, error handling, correctness, tests).
- Ignore style nitpicks unless they cause bugs or security risks.
OUTPUT RULES (IMPORTANT):
1) Default output: INLINE COMMENTS ONLY using mcp__github_inline_comment__create_inline_comment.
2) Each inline comment must be compact:
- 1 sentence: what's wrong + why it matters
- 1 sentence: recommended fix
- If possible include a GitHub suggestion block:
```suggestion
<exact replacement code>
```
3) Only if you found >= 2 significant issues, leave ONE short top-level PR comment (<= 4 bullets).
Otherwise: do not leave a top-level comment.
PROCESS:
- Use `gh pr view` to read PR title/body.
- Use `gh pr diff` to inspect changes.
- Place inline comments directly on the relevant lines.
- Do NOT restate large diff chunks.
Extra instructions (optional):
${{ inputs.review_prompt }}
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*)"