Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,32 @@ The following environment variables are set internally by the firewall and used

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

## GitHub Actions `setup-*` Tool Availability

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:

1. `setup-*` actions write their tool bin directories to the `$GITHUB_PATH` file.
2. AWF reads this file at startup and merges its entries (prepended, higher priority) into `AWF_HOST_PATH`.
3. The chroot entrypoint exports `AWF_HOST_PATH` as `PATH` inside the chroot, so tools like `uv`, `node`, `python3`, `ruby`, etc. resolve correctly.

This behavior was introduced in **awf v0.60.0** and is active automatically — no extra flags are required.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc claims the behavior was introduced in awf v0.60.0, but the repo’s current package version is 0.23.1 (package.json). Unless there’s a separate versioning scheme for the released CLI, this looks incorrect/misleading—suggest removing the specific version or updating it to the correct AWF release version that introduced the feature.

Suggested change
This behavior was introduced in **awf v0.60.0** and is active automatically — no extra flags are required.
This behavior is active automatically — no extra flags are required.

Copilot uses AI. Check for mistakes.

**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.

**Troubleshooting:** Run AWF with `--log-level debug` to see whether `GITHUB_PATH` is set and how many entries were merged:

```
[DEBUG] Merged 3 path(s) from $GITHUB_PATH into AWF_HOST_PATH
```

If you see instead:

```
[DEBUG] GITHUB_PATH env var is not set; skipping $GITHUB_PATH file merge …
```

the runner did not set `GITHUB_PATH`, and the tool's bin directory must already be in `$PATH` at AWF launch time.
Comment on lines +121 to +133
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The troubleshooting snippet’s debug line (GITHUB_PATH env var is not set; skipping $GITHUB_PATH file merge …) doesn’t match the actual log message emitted in readGitHubPathEntries() (it includes the parenthetical sudo/PATH note and no ellipsis). To avoid confusing users, update the docs to match the exact emitted message(s) (including the unreadable-file case).

Copilot uses AI. Check for mistakes.

## Debugging Environment Variables

The following environment variables control debugging behavior:
Expand Down
2 changes: 2 additions & 0 deletions src/docker-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export function extractGhHostFromServerUrl(serverUrl: string | undefined): strin
export function readGitHubPathEntries(): string[] {
const githubPathFile = process.env.GITHUB_PATH;
if (!githubPathFile) {
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)');
return [];
}

Expand All @@ -174,6 +175,7 @@ export function readGitHubPathEntries(): string[] {
.filter(line => line.length > 0);
} catch {
// File doesn't exist or isn't readable — expected outside GitHub Actions
logger.debug(`GITHUB_PATH file at '${githubPathFile}' could not be read; skipping file merge`);
Comment on lines 176 to +178
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the unreadable-file path, the catch block discards the underlying error (e.g., ENOENT vs EACCES). Since the goal here is diagnosability, consider capturing the error (catch (error)) and including it in the debug log (as a second arg) so users can tell why the file couldn't be read.

Suggested change
} catch {
// File doesn't exist or isn't readable — expected outside GitHub Actions
logger.debug(`GITHUB_PATH file at '${githubPathFile}' could not be read; skipping file merge`);
} catch (error) {
// File doesn't exist or isn't readable — expected outside GitHub Actions
logger.debug(`GITHUB_PATH file at '${githubPathFile}' could not be read; skipping file merge`, error);

Copilot uses AI. Check for mistakes.
return [];
}
}
Expand Down
Loading