Skip to content

investigate: agentic workflow skipped due to non-matching label (no fix needed)#18212

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/investigate-agentic-workflow
Closed

investigate: agentic workflow skipped due to non-matching label (no fix needed)#18212
Copilot wants to merge 3 commits intomainfrom
copilot/investigate-agentic-workflow

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

Investigated why the workflow at erikaheidi/blog was completely skipped. The workflow was correctly working as designed.

Root Cause

The workflow create-blog-post.md uses names: content-todo to filter on.issues: labeled events. gh-aw compiles this into a job-level if condition:

activation:
  if: (github.event_name != 'issues') || ((github.event.action != 'labeled') || (github.event.label.name == 'content-todo'))

Issue #43 was labeled with enhancement (not content-todo), so the condition evaluated to false and all jobs were correctly skipped.

Why No Code Change Is Made

GitHub Actions does not support a labels: filter in the on.issues trigger syntax — only types: is supported. The job-level if condition approach is the correct and only way to filter by label name for issues events. The skipped run was expected behavior, not a bug.

[!WARNING]

Original prompt

Investigate why this agentic workflow was completely skipped.

https://github.com/erikaheidi/blog/actions/runs/22369493533/job/64744316749


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

When users specify `names: label-name` in their `on.issues` or
`on.pull_request` triggers with `types: [labeled]`, gh-aw was
converting this to a job-level `if` condition. This caused the workflow
to trigger for ALL label events and be immediately "skipped" when the
label didn't match, resulting in noisy workflow runs.

GitHub Actions supports native `labels:` filtering in the `on:` section
for issues and pull_request events. For `types: [labeled]`, the filter
applies specifically to the label being applied (not existing labels).

This change adds `convertNamesToNativeLabelFilter` which renames
`names:` -> `labels:` in the frontmatter before YAML generation for
these event types. The generated lock file now uses the native filter,
preventing the workflow from triggering entirely for non-matching labels.

Discussion events are not converted because GitHub Actions does not
support `labels:` filter for discussions.

Recompiled .github/workflows/cloclo.lock.yml which had `names: cloclo`.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate skipped agentic workflow fix: use native GitHub Actions labels: filter instead of job-level conditions for issues/pull_request label triggers Feb 24, 2026
@pelikhan
Copy link
Contributor

"on":
  issues:
    labels:
    - content-todo
    types:
    - labeled
# no label-related job condition generated

This is not a valid syntax for github actions yml.

@copilot

GitHub Actions does not support a `labels:` filter in the `on.issues`
or `on.pull_request` trigger syntax. The previous change introduced
invalid YAML that would break GitHub Actions processing.

The original job-level `if` condition approach is correct:
- Workflows trigger on all `issues: labeled` events (unavoidable)
- Job conditions correctly skip when the label doesn't match
- Skipped runs for non-matching labels are expected behavior

Reverts changes to:
- pkg/workflow/filters.go
- pkg/workflow/compiler_orchestrator_workflow.go
- pkg/workflow/label_filter_test.go
- pkg/workflow/label_trigger_parser.go
- .github/workflows/cloclo.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

"on":
  issues:

...

You're right — labels: is not valid syntax for on.issues (or on.pull_request) in GitHub Actions. Only types: is supported as a filter in the trigger section for these events. I've reverted all the changes in e6b0af5.

The original job-level if condition approach is correct and should remain as-is. The skipped run at erikaheidi/blog was working as expected: issue #43 was labeled with enhancement instead of content-todo, so the activation job correctly evaluated its condition to false and skipped.

Copilot AI changed the title fix: use native GitHub Actions labels: filter instead of job-level conditions for issues/pull_request label triggers investigate: agentic workflow skipped due to non-matching label (no fix needed) Feb 24, 2026
@pelikhan pelikhan closed this Feb 25, 2026
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.

2 participants