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

Function buildWorkflowCallNetworkAllowedUpdateScript

pkg/workflow/awf_helpers.go:195–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

193}
194
195func buildWorkflowCallNetworkAllowedUpdateScript() (string, error) {
196 ecosystemDomains := getLoadedEcosystemDomains()
197 ecosystemMap := make(map[string][]string, safeAllocationCapacity(len(ecosystemDomains), len(compoundEcosystems)))
198 for ecosystem := range ecosystemDomains {
199 ecosystemMap[ecosystem] = getEcosystemDomains(ecosystem)
200 }
201 for ecosystem := range compoundEcosystems {
202 ecosystemMap[ecosystem] = getEcosystemDomains(ecosystem)
203 }
204
205 ecosystemJSON, err := json.Marshal(ecosystemMap)
206 if err != nil {
207 return "", fmt.Errorf("marshal network allowed ecosystem map: %w", err)
208 }
209
210 // Pass the ecosystem map JSON via an env var and invoke the JavaScript
211 // implementation deployed by actions/setup to ${RUNNER_TEMP}/gh-aw/actions/.
212 // Using node avoids any Python dependency and eliminates quote-injection risk:
213 // shellEscapeArg safely single-quotes and escapes the JSON payload.
214 return fmt.Sprintf(`GH_AW_ECOSYSTEM_MAP_JSON=%s node "${RUNNER_TEMP}/gh-aw/actions/update_network_allowed.cjs"`,
215 shellEscapeArg(string(ecosystemJSON))), nil
216}
217
218// BuildAWFCommand builds a complete AWF command with all arguments.
219// This consolidates the AWF command building logic that was duplicated across

Callers 1

BuildAWFCommandFunction · 0.85

Calls 5

safeAllocationCapacityFunction · 0.85
getEcosystemDomainsFunction · 0.85
shellEscapeArgFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected