Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Label trigger shorthand (on: pull_request labeled refine) was generating invalid GitHub Actions YAML. The compiler added a labels field to the on section for all event types, but GitHub Actions only supports native label filtering for issues events—not pull_request or discussion.

Changes

  • pkg/workflow/label_trigger_parser.go: Differentiate event types when expanding label trigger shorthand

    • issues: Use labels field with __gh_aw_native_label_filter__ marker (native GitHub Actions filtering)
    • pull_request and discussion: Use names field without marker (triggers job condition filtering)
  • pkg/workflow/label_trigger_parser_test.go: Update tests to expect different fields per event type

Result

For pull_request events, the generated YAML now correctly uses job conditions:

on:
  pull_request:
    types:
      - labeled
  # No 'labels' or 'names' field - filtered via job condition instead

jobs:
  activation:
    if: >
      (github.event.action != 'labeled') || (github.event.label.name == 'refine')

For issues events, native GitHub Actions filtering is preserved:

on:
  issues:
    types:
      - labeled
    labels:
      - refine
Original prompt

Fix the failing GitHub Actions workflow build
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 63493712264
Job URL: https://github.com/github/gh-aw/actions/runs/21977974466/job/63493712264


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@pelikhan pelikhan marked this pull request as ready for review February 13, 2026 07:41
Copilot AI review requested due to automatic review settings February 13, 2026 07:41
Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow build Fix label trigger schema validation for pull_request events Feb 13, 2026
Copilot AI requested a review from pelikhan February 13, 2026 07:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a failing GitHub Actions workflow build caused by incorrect label trigger schema validation. The root issue was that the label trigger parser was treating all event types (issues, pull_request, discussion) identically by adding a names field, but GitHub Actions only supports native label filtering for issues events. The fix differentiates event type handling: issues events now use the native labels field with a marker, while pull_request and discussion events use an internal names field that gets converted to job conditions.

Changes:

  • Modified label trigger parser to use labels field for issues events and names field for pull_request/discussion events
  • Updated unit tests to validate the differentiated handling
  • Regenerated refiner.lock.yml workflow with proper label filtering via job conditions
  • Added Code Refiner workflow to agent factory status page
  • Simplified documentation for GitHub App token configuration (unrelated to main fix)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/workflow/label_trigger_parser.go Core fix: differentiates label trigger handling by event type (labels for issues, names for pull_request/discussion)
pkg/workflow/label_trigger_parser_test.go Updated tests to validate labels field for issues and names field for pull_request/discussion
.github/workflows/refiner.lock.yml Regenerated workflow with commented-out names field and proper job condition filtering
docs/src/content/docs/reference/frontmatter-full.md Simplified GitHub App token documentation (unrelated to label trigger fix)
docs/src/content/docs/agent-factory-status.mdx Added Code Refiner workflow entry
Comments suppressed due to low confidence (2)

docs/src/content/docs/reference/frontmatter-full.md:3439

  • The documentation changes removing details about GitHub App per-job token narrowing and auto-revocation appear to be unrelated to the label trigger fix described in the PR description. This creates inconsistency because:
  1. The detailed documentation about token narrowing is still present in docs/src/content/docs/reference/safe-outputs.md (lines 1372-1383)
  2. The docs/src/content/docs/reference/tokens.mdx file still references this per-job narrowing behavior

Either these changes should be:

  • Reverted (if they're unintentional)
  • Applied consistently across all documentation files (if intentional)
  • Moved to a separate PR focused on documentation cleanup (recommended)
  # GitHub App credentials for minting installation access tokens. When configured,
  # a token will be generated using the app credentials and used for all safe output
  # operations.

pkg/workflow/label_trigger_parser.go:83

  • The comment references discussion events not supporting the labels field, but the actual logic on lines 116-119 uses the names field for both pull_request and discussion events. The comment should clarify that both pull_request and discussion events don't support native GitHub Actions label filtering via the labels field, so they use the internal names field for job condition filtering instead.
// Note: For discussion events, GitHub Actions doesn't support the `labels` field,
// so we use the native label filter marker but the labels will be filtered via job conditions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +112 to 120
switch entityType {
case "issues":
triggerConfig["labels"] = labelNames
triggerConfig["__gh_aw_native_label_filter__"] = true // Marker to use native filtering
case "pull_request", "discussion":
// For pull_request and discussion: add names field for job condition filtering
triggerConfig["names"] = labelNames
triggerConfig["__gh_aw_native_label_filter__"] = true // Marker to prevent commenting out names
// No marker - this will be filtered via job conditions
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration test TestLabelTriggerIntegrationSimple expects the names field for issues events (line 43-48 in the test file), but the new implementation on line 114 uses the labels field for issues events instead. This test will fail when run with the integration build tag.

The test needs to be updated to check for the labels field for issues events, matching the new behavior where:

  • issues events use the native GitHub Actions labels field
  • pull_request and discussion events use the internal names field for job condition filtering

This issue also appears on line 82 of the same file.

Copilot uses AI. Check for mistakes.
Comment on lines 1784 to +1787

# Safe output processing configuration that automatically creates GitHub issues,
# comments, and pull requests from AI workflow output without requiring write
# permissions in the main job. When using GitHub App tokens (app:), permissions
# are automatically narrowed per-job to match only what's needed, and tokens are
# auto-revoked at job end. Multiple safe outputs in the same workflow receive the
# union of their required permissions.
# permissions in the main job
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation changes removing details about GitHub App per-job token narrowing and auto-revocation appear to be unrelated to the label trigger fix described in the PR description. This creates inconsistency because:

  1. The detailed documentation about token narrowing is still present in docs/src/content/docs/reference/safe-outputs.md (lines 1372-1383)
  2. The docs/src/content/docs/reference/tokens.mdx file still references this per-job narrowing behavior

Either these changes should be:

  • Reverted (if they're unintentional)
  • Applied consistently across all documentation files (if intentional)
  • Moved to a separate PR focused on documentation cleanup (recommended)

This issue also appears on line 3437 of the same file.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 0166a05 into main Feb 13, 2026
92 of 93 checks passed
@pelikhan pelikhan deleted the copilot/fix-github-actions-workflow-cee0e0c7-a22a-4a12-933e-4d9562db4fbf branch February 13, 2026 07:45
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