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

Function GenerateRuntimeSetupSteps

pkg/workflow/runtime_step_generator.go:19–45  ·  view source on GitHub ↗

GenerateRuntimeSetupSteps creates GitHub Actions steps for runtime setup. data is the WorkflowData for the workflow being compiled; it is forwarded to generateSetupStep so that the gh-aw setup-cli step can use the lock-file-aware pin resolver (getActionPinWithData) rather than the static embedded-pi

(requirements []RuntimeRequirement, data *WorkflowData)

Source from the content-addressed store, hash-verified

17// Pass nil only when WorkflowData is unavailable or when tests specifically
18// target non-gh-aw runtime behavior.
19func GenerateRuntimeSetupSteps(requirements []RuntimeRequirement, data *WorkflowData) []GitHubActionStep {
20 runtimeStepGeneratorLog.Printf("Generating runtime setup steps: requirement_count=%d", len(requirements))
21 runtimeSetupLog.Printf("Generating runtime setup steps for %d requirements", len(requirements))
22 var steps []GitHubActionStep
23
24 for _, req := range requirements {
25 steps = append(steps, generateSetupStep(&req, data))
26
27 // Add environment variable capture steps after setup actions for AWF chroot mode.
28 // Most env vars are inherited via AWF_HOST_PATH, but Go is special.
29 switch req.Runtime.ID {
30 case "go":
31 // GitHub Actions uses "trimmed" Go binaries that require GOROOT to be explicitly set.
32 // Unlike other runtimes where PATH is sufficient, Go's trimmed binaries need GOROOT
33 // for /proc/self/exe resolution. actions/setup-go does NOT export GOROOT to the
34 // environment, so we must capture it explicitly.
35 runtimeStepGeneratorLog.Print("Adding GOROOT capture step for chroot mode compatibility")
36 steps = append(steps, generateEnvCaptureStep("GOROOT", "go env GOROOT"))
37 }
38 // Note: Java and .NET don't need capture steps anymore because:
39 // - AWF_HOST_PATH captures the complete host PATH including $JAVA_HOME/bin and $DOTNET_ROOT
40 // - AWF's entrypoint.sh exports PATH="${AWF_HOST_PATH}" which preserves all setup-* additions
41 }
42
43 runtimeStepGeneratorLog.Printf("Generated %d runtime setup steps", len(steps))
44 return steps
45}
46
47// generateEnvCaptureStep creates a step to capture an environment variable and export it.
48// This is required because some setup actions don't export env vars, but AWF chroot mode

Calls 4

generateSetupStepFunction · 0.85
generateEnvCaptureStepFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45