-
Notifications
You must be signed in to change notification settings - Fork 169
Fix label trigger schema validation for pull_request events #15321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
088f054
cf03d61
608919d
feb7bc2
59b60f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,8 +79,8 @@ func parseLabelTriggerShorthand(input string) (entityType string, labelNames []s | |
|
|
||
| // expandLabelTriggerShorthand takes an entity type and label names and returns a map that represents | ||
| // the expanded label trigger + workflow_dispatch configuration with item_number input. | ||
| // Note: For discussion events, GitHub Actions doesn't support the `names` field, | ||
| // so we use the native label filter marker but the names will be filtered via job conditions. | ||
| // 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. | ||
| func expandLabelTriggerShorthand(entityType string, labelNames []string) map[string]any { | ||
| // Create the trigger configuration based on entity type | ||
| var triggerKey string | ||
|
|
@@ -104,11 +104,19 @@ func expandLabelTriggerShorthand(entityType string, labelNames []string) map[str | |
| "types": []any{"labeled"}, | ||
| } | ||
|
|
||
| // Only add names field for issues and pull_request (GitHub Actions supports it) | ||
| // For discussions, names field is not supported by GitHub Actions | ||
| if entityType == "issues" || entityType == "pull_request" { | ||
| // Add label names for filtering | ||
| // For issues: GitHub Actions supports native `labels` field - use it with marker | ||
| // For pull_request & discussion: Use `names` field for job condition filtering (no marker) | ||
| // Note: The `names` field is an internal representation for job condition generation | ||
| // and won't be rendered in the final GitHub Actions YAML for these event types | ||
| 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 | ||
| } | ||
|
Comment on lines
+112
to
120
|
||
|
|
||
| // Create workflow_dispatch with item_number input | ||
|
|
||
There was a problem hiding this comment.
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:
docs/src/content/docs/reference/safe-outputs.md(lines 1372-1383)docs/src/content/docs/reference/tokens.mdxfile still references this per-job narrowing behaviorEither these changes should be:
This issue also appears on line 3437 of the same file.