-
Notifications
You must be signed in to change notification settings - Fork 424
feat: add safe-outputs.failure-issue-repo to redirect failure issues to a different repo
#20429
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
016f56a
ced4c54
8319f70
c38f0d9
021e193
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -205,6 +205,11 @@ func (c *Compiler) buildConclusionJob(data *WorkflowData, mainJobName string, sa | |
| agentFailureEnvVars = append(agentFailureEnvVars, " GH_AW_FAILURE_REPORT_AS_ISSUE: \"true\"\n") | ||
| } | ||
|
|
||
| // Pass failure-issue-repo configuration (optional, defaults to current repo) | ||
| if data.SafeOutputs != nil && data.SafeOutputs.FailureIssueRepo != "" { | ||
| agentFailureEnvVars = append(agentFailureEnvVars, fmt.Sprintf(" GH_AW_FAILURE_ISSUE_REPO: %q\n", data.SafeOutputs.FailureIssueRepo)) | ||
| } | ||
|
Comment on lines
+208
to
+211
|
||
|
|
||
| // Pass timeout minutes value so the failure handler can provide an actionable hint when timed out | ||
| timeoutValue := strings.TrimPrefix(data.TimeoutMinutes, "timeout-minutes: ") | ||
| if timeoutValue != "" { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -469,6 +469,14 @@ func (c *Compiler) extractSafeOutputsConfig(frontmatter map[string]any) *SafeOut | |||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Handle failure-issue-repo (repository for failure issues, format: "owner/repo") | ||||||||||||||||||||||||||||||
| if failureIssueRepo, exists := outputMap["failure-issue-repo"]; exists { | ||||||||||||||||||||||||||||||
| if failureIssueRepoStr, ok := failureIssueRepo.(string); ok && failureIssueRepoStr != "" { | ||||||||||||||||||||||||||||||
| config.FailureIssueRepo = failureIssueRepoStr | ||||||||||||||||||||||||||||||
| safeOutputsConfigLog.Printf("Failure issue repo: %s", failureIssueRepoStr) | ||||||||||||||||||||||||||||||
|
Comment on lines
+474
to
+476
|
||||||||||||||||||||||||||||||
| if failureIssueRepoStr, ok := failureIssueRepo.(string); ok && failureIssueRepoStr != "" { | |
| config.FailureIssueRepo = failureIssueRepoStr | |
| safeOutputsConfigLog.Printf("Failure issue repo: %s", failureIssueRepoStr) | |
| if failureIssueRepoStr, ok := failureIssueRepo.(string); ok { | |
| trimmed := strings.TrimSpace(failureIssueRepoStr) | |
| if trimmed != "" { | |
| parts := strings.Split(trimmed, "/") | |
| if len(parts) == 2 && parts[0] != "" && parts[1] != "" { | |
| config.FailureIssueRepo = trimmed | |
| safeOutputsConfigLog.Printf("Failure issue repo: %s", trimmed) | |
| } else { | |
| safeOutputsConfigLog.Printf("Ignoring invalid failure-issue-repo %q; expected format owner/repo", failureIssueRepoStr) | |
| } | |
| } |
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.
Parsing
GH_AW_FAILURE_ISSUE_REPOwithsplit("/")and taking the first two elements can silently mis-handle invalid values (e.g.owner/,/repo, orowner/repo/extra), leading to API calls against the wrong repo or to hard-to-diagnose failures. Recommend validating that the value matches exactlyowner/repo(two non-empty segments, no extra/) and logging a warning + falling back tocontext.repowhen invalid.This issue also appears on line 703 of the same file.