MCPcopy Create free account
hub / github.com/github/gh-aw / buildCustomSafeOutputActionsJSON

Function buildCustomSafeOutputActionsJSON

pkg/workflow/safe_outputs_actions.go:464–482  ·  view source on GitHub ↗

buildCustomSafeOutputActionsJSON builds a JSON mapping of normalized action names used for the GH_AW_SAFE_OUTPUT_ACTIONS env var of the handler manager step. This allows the handler manager to load and dispatch messages to action handlers. The map value is the normalized action name (same as key) fo

(data *WorkflowData)

Source from the content-addressed store, hash-verified

462// This allows the handler manager to load and dispatch messages to action handlers.
463// The map value is the normalized action name (same as key) for future extensibility.
464func buildCustomSafeOutputActionsJSON(data *WorkflowData) string {
465 if data.SafeOutputs == nil || len(data.SafeOutputs.Actions) == 0 {
466 return ""
467 }
468
469 actionNames := make([]string, 0, len(data.SafeOutputs.Actions))
470 for actionName := range data.SafeOutputs.Actions {
471 actionNames = append(actionNames, actionName)
472 }
473
474 jsonStr, err := buildNormalizedSortedJSON(actionNames, func(normalizedName string) string {
475 return normalizedName
476 })
477 if err != nil {
478 safeOutputActionsLog.Printf("Warning: failed to marshal custom safe output actions: %v", err)
479 return ""
480 }
481 return jsonStr
482}
483
484// actionOutputKey returns the step output key for a given normalized action name.
485// The handler exports this key and the compiler uses it in step conditions and with: blocks.

Calls 2

PrintfMethod · 0.45