Skip to content

Commit e43d7f3

Browse files
Merge pull request #44 from stickerdaniel/add-claude-github-actions-1755279694708
Add Claude Code GitHub Workflow
2 parents 9b064b1 + 65109b4 commit e43d7f3

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
# github.event.pull_request.user.login == 'external-contributor' ||
1818
# github.event.pull_request.user.login == 'new-developer' ||
1919
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
20+
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: read
2424
pull-requests: read
2525
issues: read
2626
id-token: write
27-
27+
2828
steps:
2929
- name: Checkout repository
3030
uses: actions/checkout@v4
@@ -35,10 +35,10 @@ jobs:
3535
id: claude-review
3636
uses: anthropics/claude-code-action@beta
3737
with:
38-
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3939

40-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
41-
# model: "claude-opus-4-20250514"
40+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
41+
# model: "claude-opus-4-1-20250805"
4242

4343
# Direct prompt for automated review (no @claude mention needed)
4444
direct_prompt: |
@@ -48,27 +48,31 @@ jobs:
4848
- Performance considerations
4949
- Security concerns
5050
- Test coverage
51-
51+
5252
Be constructive and helpful in your feedback.
5353
54+
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
55+
# use_sticky_comment: true
56+
5457
# Optional: Customize review based on file types
5558
# direct_prompt: |
5659
# Review this PR focusing on:
5760
# - For TypeScript files: Type safety and proper interface usage
5861
# - For API endpoints: Security, input validation, and error handling
5962
# - For React components: Performance, accessibility, and best practices
6063
# - For tests: Coverage, edge cases, and test quality
61-
64+
6265
# Optional: Different prompts for different authors
6366
# direct_prompt: |
64-
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
67+
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
6568
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
6669
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
67-
70+
6871
# Optional: Add specific tools for running tests or linting
6972
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
70-
73+
7174
# Optional: Skip review for certain conditions
7275
# if: |
7376
# !contains(github.event.pull_request.title, '[skip-review]') &&
7477
# !contains(github.event.pull_request.title, '[WIP]')
78+

.github/workflows/claude.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
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
@@ -33,26 +34,31 @@ jobs:
3334
id: claude
3435
uses: anthropics/claude-code-action@beta
3536
with:
36-
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
37-
38-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
39-
# model: "claude-opus-4-20250514"
37+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4038

39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
44+
# model: "claude-opus-4-1-20250805"
45+
4146
# Optional: Customize the trigger phrase (default: @claude)
4247
# trigger_phrase: "/claude"
43-
48+
4449
# Optional: Trigger when specific user is assigned to an issue
4550
# assignee_trigger: "claude-bot"
46-
51+
4752
# Optional: Allow Claude to run specific commands
4853
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
49-
54+
5055
# Optional: Add custom instructions for Claude to customize its behavior for your project
5156
# custom_instructions: |
5257
# Follow our coding standards
5358
# Ensure all new code has tests
5459
# Use TypeScript for new files
55-
60+
5661
# Optional: Custom environment variables for Claude
5762
# claude_env: |
5863
# NODE_ENV: test
64+

0 commit comments

Comments
 (0)