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

Function normalizeTemplatableModelFallbackEnabled

pkg/workflow/awf_config.go:129–147  ·  view source on GitHub ↗

normalizeTemplatableModelFallbackEnabled adjusts a generated AWF config document for compile-time schema validation by coercing modelFallback.enabled GitHub Actions expressions to a boolean placeholder. GitHub Actions resolves these expressions at runtime before AWF consumes the config.

(doc any)

Source from the content-addressed store, hash-verified

127// expressions to a boolean placeholder. GitHub Actions resolves these expressions at
128// runtime before AWF consumes the config.
129func normalizeTemplatableModelFallbackEnabled(doc any) {
130 root, ok := doc.(map[string]any)
131 if !ok {
132 return
133 }
134 apiProxy, ok := root["apiProxy"].(map[string]any)
135 if !ok {
136 return
137 }
138 modelFallback, ok := apiProxy["modelFallback"].(map[string]any)
139 if !ok {
140 return
141 }
142 enabled, ok := modelFallback["enabled"].(string)
143 if !ok || !isExpression(enabled) {
144 return
145 }
146 modelFallback["enabled"] = true
147}
148
149// AWFConfigFile represents the AWF configuration file schema.
150// This is the top-level structure written to awf-config.json.

Callers 1

validateAWFConfigJSONFunction · 0.85

Calls 1

isExpressionFunction · 0.85

Tested by

no test coverage detected