Skip to content

Commit 4ecb27d

Browse files
authored
Add Claude Code GitHub Workflow (#2384)
This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository. - The workflow runs automatically whenever Claude is mentioned in PR or issue comments - Claude gets access to the entire PR or issue context including files, diffs, and previous comments - Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
1 parent 32d36ac commit 4ecb27d

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/claude.yml

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

0 commit comments

Comments
 (0)