Add short trigger syntax for labeled events with explicit item types#7153
Add short trigger syntax for labeled events with explicit item types#7153
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot the label names should be applied as "names" field in the issue generated code Remove "on: labeled name" syntax, always make the target item type explicit |
…licit item type - Remove implicit "labeled" syntax - now requires "issue labeled" or "pull_request labeled" - Label names are now applied as "names" field in generated YAML (not commented out) - Add __gh_aw_native_label_filter__ marker to enable native GitHub Actions label filtering - Skip label filtering via job conditions when using native filtering - Update all tests to reflect changes - Update example workflows to use explicit syntax Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit 1bb8304. Changes made:
The implementation uses an internal marker to distinguish shorthand-expanded triggers from regular triggers, ensuring label filtering is done natively by GitHub Actions instead of via job conditions. |
|
@copilot support "pull-request" or "pull_request" |
- Support both "pull_request" and "pull-request" (with hyphen) syntax - Add support for "discussion labeled" triggers - Add comprehensive fuzz tests for parser robustness - Note: Discussions don't support names field (GitHub Actions limitation) - Update all tests to cover new features - Add example workflow for discussion labeled triggers Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit aaeef68. Changes made:
Example outputs:
|
|
@copilot make sure generated lock file are syntactically correct |
Add documentation for the new shorthand label trigger syntax that supports: - Basic format: on: issue labeled bug - Space-separated labels: on: issue labeled bug enhancement - Comma-separated labels: on: issue labeled bug, enhancement Covers features from PRs #7153, #7160, and #7169. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements shorthand syntax for label triggers that expands to full GitHub Actions configuration with workflow_dispatch and native label filtering.
Syntax
Supported variants:
on: issue labeled label1 label2 ...- Issues (explicit)on: pull_request labeled label1 label2 ...- Pull requests (explicit)on: pull-request labeled label1 label2 ...- Pull requests with hyphen (explicit)on: discussion labeled label1 label2 ...- Discussions (explicit)Note: Implicit syntax (
on: labeled label1 label2) is NOT supported - item type must be explicitly specified.Note: Discussion labeled triggers are supported, but GitHub Actions does not support the
namesfield for discussion events, so label filtering must be handled via job conditions if needed.Key Features
namesfield for GitHub Actions native filtering for issues and pull requests (not commented out)issue,pull_request,pull-request, ordiscussionto avoid ambiguityitem_numberinput parameterpull_requestandpull-requestsyntax variants are supportednamesfield due to GitHub Actions limitation)Implementation
Parser (
pkg/workflow/label_trigger_parser.go)parseLabelTriggerShorthand()- Tokenizes and validates syntax (requires explicit item type, supports pull-request hyphen variant)expandLabelTriggerShorthand()- Generates trigger config with native label filtering marker (omitsnamesfield for discussions)Integration (
pkg/workflow/schedule_preprocessing.go)Native Filtering (
pkg/workflow/frontmatter_extraction.go,pkg/workflow/filters.go)__gh_aw_native_label_filter__marker to enable native GitHub Actions label filteringnamesfieldTests
label_trigger_parser_fuzz_test.go) for parser robustness with 18+ seed casesExample Workflows
See
examples/label-trigger-simple.md,examples/label-trigger-pull-request.md, andexamples/label-trigger-discussion.mdfor working examples that compile to valid GitHub Actions workflows with native label filtering.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.