Skip to content

Commit 58fd00a

Browse files
authored
Add Claude Code GitHub Workflow (#3226)
* "Update Claude PR Assistant workflow" * "Update Claude Code Review workflow"
1 parent a321360 commit 58fd00a

File tree

2 files changed

+29
-58
lines changed

2 files changed

+29
-58
lines changed

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

Lines changed: 15 additions & 34 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
@@ -33,44 +33,25 @@ jobs:
3333

3434
- name: Run Claude Code Review
3535
id: claude-review
36-
uses: anthropics/claude-code-action@beta
36+
uses: anthropics/claude-code-action@v1
3737
with:
38-
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
3938
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
40-
41-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
42-
# model: "claude-opus-4-20250514"
43-
44-
# Direct prompt for automated review (no @claude mention needed)
45-
direct_prompt: |
39+
prompt: |
40+
REPO: ${{ github.repository }}
41+
PR NUMBER: ${{ github.event.pull_request.number }}
42+
4643
Please review this pull request and provide feedback on:
4744
- Code quality and best practices
4845
- Potential bugs or issues
4946
- Performance considerations
5047
- Security concerns
5148
- Test coverage
52-
53-
Be constructive and helpful in your feedback.
54-
55-
# Optional: Customize review based on file types
56-
# direct_prompt: |
57-
# Review this PR focusing on:
58-
# - For TypeScript files: Type safety and proper interface usage
59-
# - For API endpoints: Security, input validation, and error handling
60-
# - For React components: Performance, accessibility, and best practices
61-
# - For tests: Coverage, edge cases, and test quality
62-
63-
# Optional: Different prompts for different authors
64-
# direct_prompt: |
65-
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
66-
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
67-
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
68-
69-
# Optional: Add specific tools for running tests or linting
70-
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
71-
72-
# Optional: Skip review for certain conditions
73-
# if: |
74-
# !contains(github.event.pull_request.title, '[skip-review]') &&
75-
# !contains(github.event.pull_request.title, '[WIP]')
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:*)"'
7657

.github/workflows/claude.yml

Lines changed: 14 additions & 24 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
@@ -31,30 +32,19 @@ jobs:
3132

3233
- name: Run Claude Code
3334
id: claude
34-
uses: anthropics/claude-code-action@beta
35+
uses: anthropics/claude-code-action@v1
3536
with:
36-
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
3737
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38-
39-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
40-
# model: "claude-opus-4-20250514"
41-
42-
# Optional: Customize the trigger phrase (default: @claude)
43-
# trigger_phrase: "/claude"
44-
45-
# Optional: Trigger when specific user is assigned to an issue
46-
# assignee_trigger: "claude-bot"
47-
48-
# Optional: Allow Claude to run specific commands
49-
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
50-
51-
# Optional: Add custom instructions for Claude to customize its behavior for your project
52-
# custom_instructions: |
53-
# Follow our coding standards
54-
# Ensure all new code has tests
55-
# Use TypeScript for new files
56-
57-
# Optional: Custom environment variables for Claude
58-
# claude_env: |
59-
# NODE_ENV: test
38+
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:*)'
6050

0 commit comments

Comments
 (0)