buildCustomSafeOutputJobsJSON builds a JSON mapping of custom safe output job names to empty strings, for use in the GH_AW_SAFE_OUTPUT_JOBS env var of the handler manager step. This allows the handler manager to silently skip messages handled by custom safe-output job steps rather than reporting the
(data *WorkflowData)
| 43 | // This allows the handler manager to silently skip messages handled by custom safe-output job |
| 44 | // steps rather than reporting them as "No handler loaded for message type '...'". |
| 45 | func buildCustomSafeOutputJobsJSON(data *WorkflowData) string { |
| 46 | if data.SafeOutputs == nil || len(data.SafeOutputs.Jobs) == 0 { |
| 47 | return "" |
| 48 | } |
| 49 | |
| 50 | jobNames := make([]string, 0, len(data.SafeOutputs.Jobs)) |
| 51 | for jobName := range data.SafeOutputs.Jobs { |
| 52 | jobNames = append(jobNames, jobName) |
| 53 | } |
| 54 | |
| 55 | jsonStr, err := buildNormalizedSortedJSON(jobNames, func(string) string { return "" }) |
| 56 | if err != nil { |
| 57 | safeOutputsConfigGenLog.Printf("Warning: failed to marshal custom safe output jobs: %v", err) |
| 58 | return "" |
| 59 | } |
| 60 | return jsonStr |
| 61 | } |