Skip to content

Commit cd8bf99

Browse files
committed
ci: add claude PR review workflow using differential-review skill
Adds a dedicated claude-review.yml workflow that triggers on '@claude review' comments and runs the differential-review skill from lightninglabs/agent-skills. Uses the fix commit from anthropics/claude-code-action#963 to handle fork PRs correctly (refs/pull/N/head instead of fetching by branch name from origin). Also excludes '@claude review' from the general-purpose claude.yml to prevent both workflows from firing on the same comment. Includes a workflow_dispatch trigger for testing before merging.
1 parent 02206ab commit cd8bf99

2 files changed

Lines changed: 51 additions & 3 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Claude PR Review
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
workflow_dispatch:
9+
inputs:
10+
pr_number:
11+
description: 'PR number to review'
12+
required: true
13+
type: string
14+
15+
jobs:
16+
review:
17+
if: |
18+
github.event.issue.pull_request != null &&
19+
(
20+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude review')) ||
21+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude review'))
22+
)
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
pull-requests: write
27+
issues: write
28+
id-token: write
29+
actions: read
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 50
35+
36+
- name: Fetch agent-skills
37+
run: |
38+
git clone --depth=1 https://github.com/lightninglabs/agent-skills /tmp/agent-skills
39+
cp -r /tmp/agent-skills/skills/differential-review .claude/skills/
40+
41+
- name: Run Claude Review
42+
uses: anthropics/claude-code-action@c9a05208bd8e9f434af6a50011d3fbd091b2d4d2
43+
with:
44+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
prompt: "/differential-review"
47+
additional_permissions: |
48+
actions: read

.github/workflows/claude.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ on:
1313
jobs:
1414
claude:
1515
if: |
16-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude review')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude review')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && !contains(github.event.review.body, '@claude review')) ||
1919
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
2020
runs-on: ubuntu-latest
2121
permissions:

0 commit comments

Comments
 (0)