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

Function BuildNpmEngineInstallStepsWithAWF

pkg/workflow/nodejs.go:141–187  ·  view source on GitHub ↗

BuildNpmEngineInstallStepsWithAWF injects an AWF installation step between the Node.js setup step and the CLI install steps when the firewall is enabled. This eliminates the duplicated AWF-injection pattern shared by Claude, Gemini, and Copilot engines. The expected layout of npmSteps is: - npmStep

(npmSteps []GitHubActionStep, workflowData *WorkflowData)

Source from the content-addressed store, hash-verified

139// Returns:
140// - []GitHubActionStep: Steps in order: Node.js setup, AWF (if enabled), CLI install
141func BuildNpmEngineInstallStepsWithAWF(npmSteps []GitHubActionStep, workflowData *WorkflowData) []GitHubActionStep {
142 var steps []GitHubActionStep
143
144 if len(npmSteps) > 0 {
145 steps = append(steps, npmSteps[0]) // Node.js setup step
146 }
147
148 // Inject AWF installation after Node.js setup but before the CLI install steps
149 if isFirewallEnabled(workflowData) {
150 firewallConfig := getFirewallConfig(workflowData)
151 agentConfig := getAgentConfig(workflowData)
152 var awfVersion string
153 if firewallConfig != nil {
154 awfVersion = firewallConfig.Version
155 }
156 awfInstall := generateAWFInstallationStep(awfVersion, agentConfig)
157 if len(awfInstall) > 0 {
158 steps = append(steps, awfInstall)
159 }
160
161 // Install Docker Compose plugin for ARC/DinD runners where it may not be pre-installed.
162 if isArcDindTopology(workflowData) {
163 steps = append(steps, generateDockerComposeInstallStep())
164 }
165 }
166
167 if len(npmSteps) > 1 {
168 steps = append(steps, npmSteps[1:]...) // CLI installation and subsequent steps
169 }
170
171 // Copy Copilot CLI to daemon-visible path for ARC/DinD.
172 // The install script puts copilot at /usr/local/bin/copilot which is inside the
173 // sysroot image — not the runner's filesystem. On ARC/DinD, the AWF command
174 // references ${RUNNER_TEMP}/gh-aw/bin/copilot which is daemon-visible.
175 if isFirewallEnabled(workflowData) && isArcDindTopology(workflowData) {
176 copyStep := GitHubActionStep([]string{
177 " - name: Copy Copilot CLI to daemon-visible path",
178 " run: |",
179 " mkdir -p \"${RUNNER_TEMP}/gh-aw/bin\"",
180 " cp /usr/local/bin/copilot \"${RUNNER_TEMP}/gh-aw/bin/copilot\"",
181 " chmod +x \"${RUNNER_TEMP}/gh-aw/bin/copilot\"",
182 })
183 steps = append(steps, copyStep)
184 }
185
186 return steps
187}
188
189// GetNpmBinPathSetup returns a simple shell command that adds hostedtoolcache bin directories
190// to PATH. This is specifically for npm-installed CLIs (like Claude, Codex, and the Copilot

Callers 7

GetInstallationStepsMethod · 0.85
GetInstallationStepsMethod · 0.85
GetInstallationStepsMethod · 0.85
GetInstallationStepsMethod · 0.85
GetInstallationStepsMethod · 0.85
GetInstallationStepsMethod · 0.85
GetInstallationStepsMethod · 0.85

Calls 7

isFirewallEnabledFunction · 0.85
getFirewallConfigFunction · 0.85
getAgentConfigFunction · 0.85
isArcDindTopologyFunction · 0.85
GitHubActionStepTypeAlias · 0.85

Tested by

no test coverage detected