Skip to content

Commit c28164d

Browse files
authored
Add Claude Code GitHub Workflow (#56)
* "Update Claude PR Assistant workflow" * "Update Claude Code Review workflow"
1 parent 989effd commit c28164d

2 files changed

Lines changed: 22 additions & 57 deletions

File tree

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

Lines changed: 13 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,46 +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:
3838
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
prompt: |
40+
REPO: ${{ github.repository }}
41+
PR NUMBER: ${{ github.event.pull_request.number }}
3942
40-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
41-
# model: "claude-opus-4-1-20250805"
42-
43-
# Direct prompt for automated review (no @claude mention needed)
44-
direct_prompt: |
4543
Please review this pull request and provide feedback on:
4644
- Code quality and best practices
4745
- Potential bugs or issues
4846
- Performance considerations
4947
- Security concerns
5048
- Test coverage
51-
52-
Be constructive and helpful in your feedback.
5349
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-
57-
# Optional: Customize review based on file types
58-
# direct_prompt: |
59-
# Review this PR focusing on:
60-
# - For TypeScript files: Type safety and proper interface usage
61-
# - For API endpoints: Security, input validation, and error handling
62-
# - For React components: Performance, accessibility, and best practices
63-
# - For tests: Coverage, edge cases, and test quality
64-
65-
# Optional: Different prompts for different authors
66-
# direct_prompt: |
67-
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
68-
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
69-
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
70-
71-
# Optional: Add specific tools for running tests or linting
72-
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
73-
74-
# Optional: Skip review for certain conditions
75-
# if: |
76-
# !contains(github.event.pull_request.title, '[skip-review]') &&
77-
# !contains(github.event.pull_request.title, '[WIP]')
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:*)"'
7857

.github/workflows/claude.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,19 @@ jobs:
3232

3333
- name: Run Claude Code
3434
id: claude
35-
uses: anthropics/claude-code-action@beta
35+
uses: anthropics/claude-code-action@v1
3636
with:
3737
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3838

3939
# This is an optional setting that allows Claude to read CI results on PRs
4040
additional_permissions: |
4141
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-
46-
# Optional: Customize the trigger phrase (default: @claude)
47-
# trigger_phrase: "/claude"
48-
49-
# Optional: Trigger when specific user is assigned to an issue
50-
# assignee_trigger: "claude-bot"
51-
52-
# Optional: Allow Claude to run specific commands
53-
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
54-
55-
# Optional: Add custom instructions for Claude to customize its behavior for your project
56-
# custom_instructions: |
57-
# Follow our coding standards
58-
# Ensure all new code has tests
59-
# Use TypeScript for new files
60-
61-
# Optional: Custom environment variables for Claude
62-
# claude_env: |
63-
# NODE_ENV: test
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:*)'
6450

0 commit comments

Comments
 (0)