Skip to content

Commit 091de0b

Browse files
authored
Add Claude Code GitHub Workflow [skip-ci] (#223)
1 parent c429cc3 commit 091de0b

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/claude.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
# concurrency:
14+
# group: claude-${{ github.event.issue.number || github.event.pull_request.number }}-${{ github.event_name }}
15+
# cancel-in-progress: true
16+
jobs:
17+
claude:
18+
if: |
19+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
20+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
21+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
22+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write # Required for creating branches/commits
26+
pull-requests: write # Required for commenting on PRs
27+
issues: write # Required for commenting on issues
28+
id-token: write
29+
actions: read # Required for Claude to read CI results on PRs
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 1
35+
36+
- name: Run Claude Code
37+
id: claude
38+
uses: anthropics/claude-code-action@v1
39+
with:
40+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
41+
42+
# This is an optional setting that allows Claude to read CI results on PRs
43+
additional_permissions: |
44+
actions: read
45+
46+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
47+
# prompt: 'Update the pull request description to include a summary of changes.'
48+
49+
# Optional: Add claude_args to customize behavior and configuration
50+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
51+
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
52+
# claude_args: '--allowed-tools Bash(gh pr:*)'
53+

0 commit comments

Comments
 (0)