Skip to content

Commit 6cee558

Browse files
committed
Add Claude Code GitHub Actions workflows
1 parent 855bf12 commit 6cee558

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

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

.github/workflows/claude.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
# Only repository owners can trigger this workflow (author_association == 'OWNER').
16+
if: |
17+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && github.event.comment.author_association == 'OWNER') ||
18+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && github.event.comment.author_association == 'OWNER') ||
19+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && github.event.review.author_association == 'OWNER') ||
20+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) && github.event.issue.author_association == 'OWNER')
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
issues: read
26+
id-token: write
27+
actions: read # Required for Claude to read CI results on PRs
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v6
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code
35+
id: claude
36+
uses: anthropics/claude-code-action@v1
37+
with:
38+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
40+
# This is an optional setting that allows Claude to read CI results on PRs
41+
additional_permissions: |
42+
actions: read
43+
44+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
45+
# prompt: 'Update the pull request description to include a summary of changes.'
46+
47+
# Optional: Add claude_args to customize behavior and configuration
48+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
49+
# or https://code.claude.com/docs/en/cli-reference for available options
50+
# claude_args: '--allowed-tools Bash(gh pr:*)'
51+

0 commit comments

Comments
 (0)