Skip to content

Commit 8fcfbb8

Browse files
authored
fix: debug logging for GITHUB_PATH merge + document setup-* tool availability in chroot (#1468)
* Initial plan * fix: add debug logging for GITHUB_PATH path merge --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 1110a9a commit 8fcfbb8

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

docs/environment.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,32 @@ The following environment variables are set internally by the firewall and used
106106

107107
**Note:** These are set automatically based on CLI options and should not be overridden manually.
108108

109+
## GitHub Actions `setup-*` Tool Availability
110+
111+
Tools installed by GitHub Actions `setup-*` actions (e.g., `astral-sh/setup-uv`, `actions/setup-node`, `ruby/setup-ruby`, `actions/setup-python`) are **automatically available inside the AWF chroot**. This works by:
112+
113+
1. `setup-*` actions write their tool bin directories to the `$GITHUB_PATH` file.
114+
2. AWF reads this file at startup and merges its entries (prepended, higher priority) into `AWF_HOST_PATH`.
115+
3. The chroot entrypoint exports `AWF_HOST_PATH` as `PATH` inside the chroot, so tools like `uv`, `node`, `python3`, `ruby`, etc. resolve correctly.
116+
117+
This behavior was introduced in **awf v0.60.0** and is active automatically — no extra flags are required.
118+
119+
**Fallback behavior:** If `GITHUB_PATH` is not set (e.g., outside GitHub Actions or on self-hosted runners that don't set it), AWF uses `process.env.PATH` as the chroot PATH. If `sudo` has reset `PATH` before AWF runs and `GITHUB_PATH` is also absent, the tool's directory may be missing from the chroot PATH. In that case, invoke the tool via its absolute path or ensure `GITHUB_PATH` is set.
120+
121+
**Troubleshooting:** Run AWF with `--log-level debug` to see whether `GITHUB_PATH` is set and how many entries were merged:
122+
123+
```
124+
[DEBUG] Merged 3 path(s) from $GITHUB_PATH into AWF_HOST_PATH
125+
```
126+
127+
If you see instead:
128+
129+
```
130+
[DEBUG] GITHUB_PATH env var is not set; skipping $GITHUB_PATH file merge …
131+
```
132+
133+
the runner did not set `GITHUB_PATH`, and the tool's bin directory must already be in `$PATH` at AWF launch time.
134+
109135
## Debugging Environment Variables
110136

111137
The following environment variables control debugging behavior:

src/docker-manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export function extractGhHostFromServerUrl(serverUrl: string | undefined): strin
163163
export function readGitHubPathEntries(): string[] {
164164
const githubPathFile = process.env.GITHUB_PATH;
165165
if (!githubPathFile) {
166+
logger.debug('GITHUB_PATH env var is not set; skipping $GITHUB_PATH file merge (tools installed by setup-* actions may be missing from PATH if sudo reset it)');
166167
return [];
167168
}
168169

@@ -174,6 +175,7 @@ export function readGitHubPathEntries(): string[] {
174175
.filter(line => line.length > 0);
175176
} catch {
176177
// File doesn't exist or isn't readable — expected outside GitHub Actions
178+
logger.debug(`GITHUB_PATH file at '${githubPathFile}' could not be read; skipping file merge`);
177179
return [];
178180
}
179181
}

0 commit comments

Comments
 (0)