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

Function buildSafeOutputsSection

pkg/cli/commands.go:146–166  ·  view source on GitHub ↗

buildSafeOutputsSection generates the safe-outputs section of the workflow template. It uses the JSON schema to derive the valid safe output type names, ensuring the template is always consistent with what the schema accepts.

()

Source from the content-addressed store, hash-verified

144// It uses the JSON schema to derive the valid safe output type names, ensuring the
145// template is always consistent with what the schema accepts.
146func buildSafeOutputsSection() string {
147 keys, err := parser.GetSafeOutputTypeKeys()
148 if err != nil {
149 commandsLog.Printf("Failed to get safe output type keys from schema: %v", err)
150 // Fallback to a minimal static section
151 return "# Outputs - what APIs and tools can the AI use?\nsafe-outputs:\n create-issue: # Creates issues (default max: 1)\n"
152 }
153
154 var sb strings.Builder
155 sb.WriteString("# Outputs - what APIs and tools can the AI use?\n")
156 sb.WriteString("safe-outputs:\n")
157 sb.WriteString(" create-issue: # Creates issues (default max: 1)\n")
158 sb.WriteString(" max: 5 # Optional: specify maximum number\n")
159 for _, key := range keys {
160 if key == "create-issue" {
161 continue
162 }
163 sb.WriteString(" # " + key + ":\n")
164 }
165 return sb.String()
166}

Callers 2

createWorkflowTemplateFunction · 0.85

Calls 3

GetSafeOutputTypeKeysFunction · 0.92
PrintfMethod · 0.45
StringMethod · 0.45

Tested by 1