Commit 08628bf
fix: Add GitHub Actions-level filtering for Claude workflow triggers (#9)
## Summary
- Add `if:` conditions to Claude workflows to filter at GitHub Actions
level
- Prevent wasteful job runs when trigger phrases are not present in
comments
- Use `settings:` parameter instead of `claude_args` for settings file
- Save runner minutes by skipping VM allocation for non-matching events
## Problem
Previously, the workflows relied solely on the `trigger_phrase`
parameter inside the `claude-code-action`, which meant:
- GitHub Actions would start a VM for **every** comment/review
- The action would check the trigger phrase **after** resources were
allocated
- Runner minutes were wasted even when the trigger phrase wasn't present
## Solution
Added GitHub Actions-level `if:` conditions that check trigger phrases
**before** starting jobs:
### `claude.yml`
- Only runs on issues (opened/assigned) - no filtering needed
- For comments/reviews: only runs if `@claude` is present
- Use `settings:` parameter for settings file (recommended approach)
### `claude-code-review.yml`
- Runs on all PR opens (auto-review)
- For comments: only runs if `/review` is present
## Impact
✅ Prevents unnecessary VM starts
✅ Reduces runner minute consumption
✅ Jobs skip entirely when trigger phrases are absent
✅ Same functionality for users (trigger phrases still work the same)
✅ Follows recommended configuration approach
## Test plan
- [ ] Open a PR and verify auto-review still runs
- [ ] Comment "LGTM" without trigger phrase → workflow should skip
- [ ] Comment "/review" on PR → workflow should run
- [ ] Comment "@claude do something" → workflow should run
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 09e262d commit 08628bf
2 files changed
Lines changed: 18 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 18 | | |
27 | 19 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
| |||
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 52 | + | |
| 53 | + | |
0 commit comments