GetNpmBinPathSetup returns a simple shell command that adds hostedtoolcache bin directories to PATH. This is specifically for npm-installed CLIs (like Claude, Codex, and the Copilot driver) that need to find their binaries installed via `npm install -g` or via `actions/setup-node`. Unlike GetHosted
()
| 202 | // Returns: |
| 203 | // - string: A shell command that exports PATH with hostedtoolcache bin directories prepended |
| 204 | func GetNpmBinPathSetup() string { |
| 205 | // Find all bin directories in hostedtoolcache (Node.js, Python, etc.) |
| 206 | // This finds paths like /opt/hostedtoolcache/node/22.13.0/x64/bin |
| 207 | // or whatever path the runner exposes through RUNNER_TOOL_CACHE. |
| 208 | // |
| 209 | // After the find, re-prepend GOROOT/bin if set. The find returns directories |
| 210 | // alphabetically, so go/1.23.12 shadows go/1.25.0. Re-prepending GOROOT/bin |
| 211 | // ensures the Go version set by actions/setup-go takes precedence. |
| 212 | // AWF's entrypoint.sh exports GOROOT before the user command runs. |
| 213 | return `: "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; export PATH="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr '\n' ':')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true` |
| 214 | } |
| 215 | |
| 216 | // GenerateNpmInstallStepsWithScope generates npm installation steps with control over global vs local installation. |
| 217 | // By default, --ignore-scripts is added to the install command to prevent pre/post install |
no outgoing calls