Skip to content

Commit a0fa9e1

Browse files
authored
Merge pull request #1 from ascorbic/add-claude-github-actions-1760432230117
Add Claude Code GitHub Workflow
2 parents a17f996 + d05737b commit a0fa9e1

2 files changed

Lines changed: 76 additions & 41 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
# Optional: Filter by PR author
16+
# if: |
17+
# github.event.pull_request.user.login == 'external-contributor' ||
18+
# github.event.pull_request.user.login == 'new-developer' ||
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
issues: read
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code Review
35+
id: claude-review
36+
uses: anthropics/claude-code-action@v1
37+
with:
38+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
prompt: |
40+
REPO: ${{ github.repository }}
41+
PR NUMBER: ${{ github.event.pull_request.number }}
42+
43+
Please review this pull request and provide feedback on:
44+
- Code quality and best practices
45+
- Potential bugs or issues
46+
- Performance considerations
47+
- Security concerns
48+
- Test coverage
49+
50+
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
51+
52+
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53+
54+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55+
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
56+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
57+

.github/workflows/claude.yml

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Claude PR Assistant
1+
name: Claude Code
22

33
on:
44
issue_comment:
@@ -11,62 +11,40 @@ on:
1111
types: [submitted]
1212

1313
jobs:
14-
claude-code-action:
14+
claude:
1515
if: |
1616
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
1717
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
1818
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19-
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
2020
runs-on: ubuntu-latest
2121
permissions:
2222
contents: read
2323
pull-requests: read
2424
issues: read
2525
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
2627
steps:
2728
- name: Checkout repository
2829
uses: actions/checkout@v4
2930
with:
3031
fetch-depth: 1
3132

32-
- name: Install pnpm
33-
uses: pnpm/action-setup@v4
34-
35-
- name: Setup Node.js
36-
uses: actions/setup-node@v4
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@v1
3736
with:
38-
node-version: "lts/*"
39-
cache: "pnpm"
37+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4038

41-
- name: Install dependencies
42-
run: pnpm install
39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44+
# prompt: 'Update the pull request description to include a summary of changes.'
45+
46+
# Optional: Add claude_args to customize behavior and configuration
47+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48+
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
49+
# claude_args: '--allowed-tools Bash(gh pr:*)'
4350

44-
- name: Run Claude PR Action
45-
uses: anthropics/claude-code-action@beta
46-
with:
47-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
48-
timeout_minutes: "5"
49-
# mcp_config: |
50-
# {
51-
# "mcpServers": {
52-
# "astro-docs": {
53-
# "type": "http",
54-
# "url": "https://mcp.docs.astro.build/mcp"
55-
# }
56-
# }
57-
# }
58-
allowed_tools: |
59-
Bash(pnpm install)
60-
Bash(pnpm run:*)
61-
Bash(npm run:*)
62-
Bash(npx packages/am-i-vibing)
63-
# mcp__astro-docs__search_astro_docs
64-
# Optional: Restrict network access to specific domains only
65-
# experimental_allowed_domains: |
66-
# .anthropic.com
67-
# .github.com
68-
# api.github.com
69-
# .githubusercontent.com
70-
# bun.sh
71-
# registry.npmjs.org
72-
# .blob.core.windows.net

0 commit comments

Comments
 (0)