Skip to content

Commit 726232a

Browse files
docs(environment-variables): document system-injected GITHUB_AW, GH_AW_PHASE, GH_AW_VERSION runtime variables (#20412)
1 parent cf3969b commit 726232a

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

docs/src/content/docs/reference/environment-variables.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,29 @@ echo "Found 3 issues across 12 files." >> "$GITHUB_STEP_SUMMARY"
9898

9999
The output appears in the **Summary** tab of the GitHub Actions workflow run.
100100

101+
## System-Injected Runtime Variables
102+
103+
GitHub Agentic Workflows automatically injects the following environment variables into every agentic engine execution step (both the main agent run and the threat detection run). These variables are read-only from the agent's perspective and are useful for writing workflows or agents that need to detect their execution context.
104+
105+
| Variable | Value | Description |
106+
|----------|-------|-------------|
107+
| `GITHUB_AW` | `"true"` | Present in every gh-aw engine execution step. Agents can check for this variable to confirm they are running inside a GitHub Agentic Workflow. |
108+
| `GH_AW_PHASE` | `"agent"` or `"detection"` | Identifies which execution phase is active. `"agent"` for the main run; `"detection"` for the threat-detection safety check run that precedes the main run. |
109+
| `GH_AW_VERSION` | e.g. `"0.40.1"` | The gh-aw compiler version that generated the workflow. Useful for conditional logic that depends on a minimum feature version. |
110+
111+
These variables appear alongside other `GH_AW_*` context variables in the compiled workflow:
112+
113+
```yaml
114+
env:
115+
GITHUB_AW: "true"
116+
GH_AW_PHASE: agent # or "detection"
117+
GH_AW_VERSION: "0.40.1"
118+
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
119+
```
120+
121+
> [!NOTE]
122+
> These variables are injected by the compiler and cannot be overridden by user-defined `env:` blocks in the workflow frontmatter.
123+
101124
## Precedence Rules
102125

103126
Environment variables follow a **most-specific-wins** model, consistent with GitHub Actions. Variables at more specific scopes completely override variables with the same name at less specific scopes.

0 commit comments

Comments
 (0)