Skip to content

fix: Add GitHub Actions-level filtering for Claude workflow triggers - #9

Merged
Enteee merged 2 commits into
mainfrom
fix/workflow-trigger-filtering
Nov 1, 2025
Merged

fix: Add GitHub Actions-level filtering for Claude workflow triggers#9
Enteee merged 2 commits into
mainfrom
fix/workflow-trigger-filtering

Conversation

@Enteee

@Enteee Enteee commented Nov 1, 2025

Copy link
Copy Markdown
Owner

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

Enteee and others added 2 commits November 1, 2025 20:34
Prevent wasteful job runs by filtering at the GitHub Actions level
instead of relying solely on internal trigger_phrase checking.

Changes:
- claude.yml: Only run on issues or comments/reviews containing @claude
- claude-code-review.yml: Only run on PR open or comments with /review

This prevents VMs from starting and consuming runner minutes for
comments that don't contain the required trigger phrases.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Use the dedicated 'settings' parameter for specifying the settings file
instead of passing it through claude_args. This is the recommended
approach per the claude-code-action documentation.

Reference: https://github.com/anthropics/claude-code-action/blob/main/docs/configuration.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Enteee
Enteee merged commit 08628bf into main Nov 1, 2025
4 of 5 checks passed
@Enteee
Enteee deleted the fix/workflow-trigger-filtering branch November 1, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant