Skip to content

Commit 99bfdcd

Browse files
committed
ci: claude GitHub actions are triggered on demand by tagging claude
1 parent e3d8aa7 commit 99bfdcd

File tree

2 files changed

+29
-40
lines changed

2 files changed

+29
-40
lines changed
Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
name: Claude Code Review
22

33
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"
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
pull_request_review:
9+
types: [submitted]
1210

1311
jobs:
1412
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-
13+
# Only run when @claude is mentioned in comments/reviews AND it's on a pull request
14+
if: |
15+
(github.event_name == 'issue_comment' &&
16+
github.event.issue.pull_request &&
17+
contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review_comment' &&
19+
contains(github.event.comment.body, '@claude')) ||
20+
(github.event_name == 'pull_request_review' &&
21+
contains(github.event.review.body, '@claude'))
22+
2123
runs-on: ubuntu-latest
2224
permissions:
2325
contents: read
2426
pull-requests: read
2527
issues: read
2628
id-token: write
27-
29+
2830
steps:
2931
- name: Checkout repository
3032
uses: actions/checkout@v4
@@ -36,40 +38,28 @@ jobs:
3638
uses: anthropics/claude-code-action@beta
3739
with:
3840
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
39-
41+
4042
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
4143
# model: "claude-opus-4-20250514"
42-
43-
# Direct prompt for automated review (no @claude mention needed)
44+
45+
# Direct prompt for on-demand review
4446
direct_prompt: |
4547
Please review this pull request and provide feedback on:
4648
- Code quality and best practices
4749
- Potential bugs or issues
4850
- Performance considerations
4951
- Security concerns
5052
- Test coverage
51-
53+
5254
Be constructive and helpful in your feedback.
53-
55+
5456
# Optional: Customize review based on file types
5557
# direct_prompt: |
5658
# Review this PR focusing on:
5759
# - For TypeScript files: Type safety and proper interface usage
5860
# - For API endpoints: Security, input validation, and error handling
5961
# - For React components: Performance, accessibility, and best practices
6062
# - For tests: Coverage, edge cases, and test quality
61-
62-
# Optional: Different prompts for different authors
63-
# direct_prompt: |
64-
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
65-
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
66-
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
67-
63+
6864
# Optional: Add specific tools for running tests or linting
6965
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
70-
71-
# Optional: Skip review for certain conditions
72-
# if: |
73-
# !contains(github.event.pull_request.title, '[skip-review]') &&
74-
# !contains(github.event.pull_request.title, '[WIP]')
75-

.github/workflows/claude.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,25 @@ jobs:
3434
uses: anthropics/claude-code-action@beta
3535
with:
3636
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
37-
37+
3838
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
3939
# model: "claude-opus-4-20250514"
40-
40+
4141
# Optional: Customize the trigger phrase (default: @claude)
4242
# trigger_phrase: "/claude"
43-
43+
4444
# Optional: Trigger when specific user is assigned to an issue
4545
# assignee_trigger: "claude-bot"
46-
46+
4747
# Optional: Allow Claude to run specific commands
4848
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
49-
49+
5050
# Optional: Add custom instructions for Claude to customize its behavior for your project
5151
# custom_instructions: |
5252
# Follow our coding standards
5353
# Ensure all new code has tests
5454
# Use TypeScript for new files
55-
55+
5656
# Optional: Custom environment variables for Claude
5757
# claude_env: |
5858
# NODE_ENV: test
59-

0 commit comments

Comments
 (0)