Skip to content

Commit f14d4e4

Browse files
authored
Add Claude Code GitHub Workflow (#4009)
## 🤖 Installing Claude Code GitHub App This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository. ### What is Claude Code? [Claude Code](https://claude.ai/code) is an AI coding agent that can help with: - Bug fixes and improvements - Documentation updates - Implementing new features - Code reviews and suggestions - Writing tests - And more! ### How it works Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment. Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action. ### Important Notes - **This workflow won't take effect until this PR is merged** - **@claude mentions won't work until after the merge is complete** - 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 ### Security - Our Anthropic API key is securely stored as a GitHub Actions secret - Only users with write access to the repository can trigger the workflow - All Claude runs are stored in the GitHub Actions run history - Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits. - We can add more allowed tools by adding them to the workflow file like: ``` allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test) ``` There's more information in the [Claude Code action repo](https://github.com/anthropics/claude-code-action). After merging this PR, let's try mentioning @claude in a comment on any PR to get started! --------- Signed-off-by: Robert Kruszewski <github@robertk.io>
1 parent 7f84d7c commit f14d4e4

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/claude.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
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')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
- uses: ./.github/actions/setup-rust
31+
- name: Install uv
32+
uses: spiraldb/actions/.github/actions/setup-uv@0.14.0
33+
with:
34+
sync: false
35+
36+
- name: Run Claude Code
37+
id: claude
38+
uses: anthropics/claude-code-action@beta
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: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
47+
# model: "claude-opus-4-20250514"
48+
49+
# Optional: Customize the trigger phrase (default: @claude)
50+
# trigger_phrase: "/claude"
51+
52+
# Optional: Trigger when specific user is assigned to an issue
53+
# assignee_trigger: "claude-bot"
54+
55+
allowed_tools: "Bash(cargo nextest:*),Bash(cargo check:*),Bash(cargo clippy:*),Bash(cargo fmt:*),Bash(uv run:*)"
56+
57+
# Optional: Add custom instructions for Claude to customize its behavior for your project
58+
custom_instructions: "You have also been granted tools:
59+
- for editing files and running cargo commands (cargo nextest, cargo check, cargo clippy, cargo fmt).
60+
- uv for running pytest (e.g. via uv run --all-packages pytest)"
61+
62+
# Optional: Custom environment variables for Claude
63+
# claude_env: |
64+
# NODE_ENV: test

0 commit comments

Comments
 (0)