-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (60 loc) · 2.22 KB
/
claude-pr-review.yml
File metadata and controls
69 lines (60 loc) · 2.22 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
name: Claude PR Review
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
concurrency:
group: pr-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
review:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: 3060111
private-key: ${{ secrets.HOTDATA_AUTOMATION_PRIVATE_KEY }}
owner: hotdata-dev
- uses: actions/checkout@v4
with:
repository: hotdata-dev/github-workflows
ref: main
token: ${{ steps.app-token.outputs.token }}
path: .github-workflows
sparse-checkout: docs/claude-pr-review-prompt.md
sparse-checkout-cone-mode: false
- name: Load review prompt
id: prompt
run: |
PROMPT=$(cat .github-workflows/docs/claude-pr-review-prompt.md)
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$PROMPT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- uses: anthropics/claude-code-action@v1
id: review
continue-on-error: true
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
track_progress: false
allowed_bots: "hotdata-automation[bot]"
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
${{ steps.prompt.outputs.content }}
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr review:*),Read"
- name: Notify on review failure
if: steps.review.outcome == 'failure' || steps.review.outcome == 'cancelled'
run: gh pr comment ${{ github.event.pull_request.number }} --body "Automated review unavailable (Claude step failed). Please review manually."
env:
GH_TOKEN: ${{ github.token }}