Skip to content

Commit 83e61a0

Browse files
authored
ci: Add Claude Code GitHub Workflow (#20)
* Claude PR Assistant workflow * Claude Code Review workflow * refactor: Update Claude Code Review workflow to trigger on issue comments and enhance permissions Signed-off-by: Eden Reich <eden.reich@gmail.com> --------- Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent 47645bf commit 83e61a0

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Claude Code Review
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
8+
jobs:
9+
claude-review:
10+
if: |
11+
github.event_name == 'issue_comment' &&
12+
github.event.issue.pull_request &&
13+
contains(github.event.comment.body, '@claude /review')
14+
runs-on: ubuntu-24.04
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
issues: write
19+
id-token: write
20+
actions: read
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 1
27+
28+
- name: Run Claude Code Review
29+
id: claude-review
30+
uses: anthropics/claude-code-action@beta
31+
with:
32+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
33+
use_commit_signing: true
34+
base_branch: main
35+
branch_prefix: 'claude/'
36+
mcp_config: |
37+
{
38+
"mcpServers": {
39+
"context7": {
40+
"command": "npx",
41+
"args": ["-y", "@upstash/context7-mcp@latest"],
42+
"env": {}
43+
}
44+
}
45+
}
46+
direct_prompt: |
47+
Please review this pull request and provide feedback on:
48+
- Code quality and best practices
49+
- Potential bugs or issues
50+
- Performance considerations
51+
- Security concerns
52+
- Test coverage
53+
54+
Be constructive and helpful in your feedback.

.github/workflows/claude.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
pull_request_review_comment:
8+
types:
9+
- created
10+
issues:
11+
types:
12+
- opened
13+
- assigned
14+
pull_request_review:
15+
types:
16+
- submitted
17+
18+
jobs:
19+
claude:
20+
if: |
21+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude /review')) ||
22+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude /review')) ||
23+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && !contains(github.event.review.body, '@claude /review')) ||
24+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
25+
runs-on: ubuntu-24.04
26+
permissions:
27+
contents: write
28+
pull-requests: write
29+
issues: write
30+
id-token: write
31+
actions: read
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 1
37+
38+
- name: Install task
39+
run: |
40+
curl -s https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin v3.44.1
41+
42+
- name: Run Claude Code
43+
id: claude
44+
uses: anthropics/claude-code-action@beta
45+
with:
46+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
47+
additional_permissions: |
48+
actions: read
49+
use_commit_signing: true
50+
base_branch: main
51+
branch_prefix: 'claude/'
52+
custom_instructions: |
53+
IMPORTANT: You must NEVER push directly to the main branch. Always:
54+
1. Create a new feature branch (claude/feature-name)
55+
2. Make your changes on the feature branch
56+
3. Open a pull request to main
57+
4. Wait for review and approval before merging
58+
59+
COMMIT MESSAGE FORMAT: Always use conventional commits with capital letters.
60+
Follow the format: "type(scope): Description" where the description starts with a capital letter.
61+
Examples: "feat(a2a): Add retry mechanism for agent connections", "fix(auth): Resolve token validation issue"
62+
63+
Follow the development workflow specified in the coding instructions.
64+
mcp_config: |
65+
{
66+
"mcpServers": {
67+
"context7": {
68+
"command": "npx",
69+
"args": ["-y", "@upstash/context7-mcp@latest"],
70+
"env": {}
71+
}
72+
}
73+
}
74+
allowed_tools: |
75+
Bash(task:*)
76+
Bash(gh:*)
77+
Bash(git:*)

0 commit comments

Comments
 (0)