Skip to content

Commit b496135

Browse files
authored
Merge pull request #24 from gf712/add-claude-github-actions-1782289925580
ci: use claude for PR reviews and respond to comments @gf712
2 parents af25589 + 35e5c9d commit b496135

4 files changed

Lines changed: 427 additions & 1 deletion

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review, reopened]
6+
7+
jobs:
8+
claude-review:
9+
# Only review PRs opened by the repository owner
10+
if: github.event.pull_request.user.login == 'gf712'
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
issues: read
17+
id-token: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 1
24+
25+
- name: Run Claude Code Review
26+
id: claude-review
27+
uses: anthropics/claude-code-action@v1
28+
with:
29+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
30+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
31+
plugins: 'code-review@claude-code-plugins'
32+
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
33+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
34+
# or https://code.claude.com/docs/en/cli-reference for available options
35+

‎.github/workflows/claude.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Claude Code
2+
3+
on:
4+
pull_request_review_comment:
5+
types: [created]
6+
pull_request_review:
7+
types: [submitted]
8+
9+
jobs:
10+
claude:
11+
if: |
12+
github.actor == 'gf712' && (
13+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
14+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
15+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
16+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
17+
)
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
pull-requests: read
22+
issues: read
23+
id-token: write
24+
actions: read # Required for Claude to read CI results on PRs
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 1
30+
31+
- name: Run Claude Code
32+
id: claude
33+
uses: anthropics/claude-code-action@v1
34+
with:
35+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
36+
37+
# This is an optional setting that allows Claude to read CI results on PRs
38+
additional_permissions: |
39+
actions: read

0 commit comments

Comments
 (0)