hasAnySafeOutputEnabled reports whether any safe output field is non-nil. It uses direct struct-field nil checks instead of reflection for performance; this function is called on every compilation and is on the hot path. NOTE: keep this function in sync with safeOutputFieldMapping above and hasNonB
(safeOutputs *SafeOutputsConfig)
| 30 | // NOTE: keep this function in sync with safeOutputFieldMapping above and |
| 31 | // hasNonBuiltinSafeOutputsEnabled below when adding new safe output types. |
| 32 | func hasAnySafeOutputEnabled(safeOutputs *SafeOutputsConfig) bool { |
| 33 | if safeOutputs == nil { |
| 34 | return false |
| 35 | } |
| 36 | |
| 37 | // Check map fields separately |
| 38 | if len(safeOutputs.Jobs) > 0 || len(safeOutputs.Scripts) > 0 || len(safeOutputs.Actions) > 0 { |
| 39 | return true |
| 40 | } |
| 41 | |
| 42 | // Direct nil checks — no reflection, no heap allocation (43 fields matching safeOutputFieldMapping |
| 43 | // plus CommentMemory which is attached via tools.comment-memory and not in safeOutputFieldMapping). |
| 44 | return safeOutputs.CreateIssues != nil || |
| 45 | safeOutputs.CreateAgentSessions != nil || |
| 46 | safeOutputs.CreateDiscussions != nil || |
| 47 | safeOutputs.UpdateDiscussions != nil || |
| 48 | safeOutputs.CloseDiscussions != nil || |
| 49 | safeOutputs.CloseIssues != nil || |
| 50 | safeOutputs.ClosePullRequests != nil || |
| 51 | safeOutputs.MarkPullRequestAsReadyForReview != nil || |
| 52 | safeOutputs.AddComments != nil || |
| 53 | safeOutputs.CommentMemory != nil || |
| 54 | safeOutputs.CreatePullRequests != nil || |
| 55 | safeOutputs.CreatePullRequestReviewComments != nil || |
| 56 | safeOutputs.SubmitPullRequestReview != nil || |
| 57 | safeOutputs.ReplyToPullRequestReviewComment != nil || |
| 58 | safeOutputs.ResolvePullRequestReviewThread != nil || |
| 59 | safeOutputs.CreateCodeScanningAlerts != nil || |
| 60 | safeOutputs.AutofixCodeScanningAlert != nil || |
| 61 | safeOutputs.CreateCheckRun != nil || |
| 62 | safeOutputs.AddLabels != nil || |
| 63 | safeOutputs.RemoveLabels != nil || |
| 64 | safeOutputs.ReplaceLabel != nil || |
| 65 | safeOutputs.AddReviewer != nil || |
| 66 | safeOutputs.AssignMilestone != nil || |
| 67 | safeOutputs.AssignToAgent != nil || |
| 68 | safeOutputs.AssignToUser != nil || |
| 69 | safeOutputs.UnassignFromUser != nil || |
| 70 | safeOutputs.UpdateIssues != nil || |
| 71 | safeOutputs.UpdatePullRequests != nil || |
| 72 | safeOutputs.MergePullRequest != nil || |
| 73 | safeOutputs.PushToPullRequestBranch != nil || |
| 74 | safeOutputs.UploadAssets != nil || |
| 75 | safeOutputs.UploadArtifact != nil || |
| 76 | safeOutputs.UpdateRelease != nil || |
| 77 | safeOutputs.UpdateProjects != nil || |
| 78 | safeOutputs.CreateProjects != nil || |
| 79 | safeOutputs.CreateProjectStatusUpdates != nil || |
| 80 | safeOutputs.LinkSubIssue != nil || |
| 81 | safeOutputs.HideComment != nil || |
| 82 | safeOutputs.DispatchWorkflow != nil || |
| 83 | safeOutputs.DispatchRepository != nil || |
| 84 | safeOutputs.CallWorkflow != nil || |
| 85 | safeOutputs.MissingTool != nil || |
| 86 | safeOutputs.MissingData != nil || |
| 87 | safeOutputs.SetIssueType != nil || |
| 88 | safeOutputs.SetIssueField != nil || |
| 89 | safeOutputs.NoOp != nil |
no outgoing calls