From 8756e85164c769eaaa928244fde1f115f14b30ed Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 11 Mar 2026 19:02:28 +0000 Subject: [PATCH] refactor: simplify default case in buildSafeOutputJobsEnvVars Invert the systemSafeOutputJobNames condition to reduce the number of continue statements in the default case from two to one. This makes the control flow clearer: all paths in the default case lead to a single continue at the end, with the conditional assignment being the only variable part. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/workflow/notify_comment.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/workflow/notify_comment.go b/pkg/workflow/notify_comment.go index 652faf2751..eca0f41962 100644 --- a/pkg/workflow/notify_comment.go +++ b/pkg/workflow/notify_comment.go @@ -477,13 +477,11 @@ func buildSafeOutputJobsEnvVars(jobNames []string) (string, []string) { case "push_to_pull_request_branch": urlKey = "commit_url" default: - if systemSafeOutputJobNames[jobName] { - // Skip known system jobs — they are not custom safe output types - continue + if !systemSafeOutputJobNames[jobName] { + // Custom safe-output job: include in the mapping with an empty URL key so the + // handler manager can silently skip messages of this type. + jobOutputMapping[jobName] = "" } - // Custom safe-output job: include in the mapping with an empty URL key so the - // handler manager can silently skip messages of this type. - jobOutputMapping[jobName] = "" continue }