Summary
start_difc_proxy.sh writes GH_HOST=localhost:18443 to $GITHUB_ENV, which persists to all subsequent steps in the job. Any gh CLI command in a user-defined steps: block that uses an explicit --repo flag then treats the DIFC proxy as a GitHub Enterprise Server, attempts an enterprise version check against it, receives an empty version string, and exits with:
This crashes the step before any real work is done.
Affected scope
gh commands with an explicit --repo owner/repo flag in user-defined steps: that run after "Start DIFC Proxy". Commands that omit --repo (relying on GITHUB_REPOSITORY) appear to be unaffected — gh uses GITHUB_API_URL directly in that case and skips the host version check.
Comparison: A comparable workflow on fsprojects/FSharp.Data using the same gh-aw v0.76.1 does NOT reproduce this. Its steps: use gh issue list --state open ... and gh pr list --state open ... without --repo, which succeed fine even with GH_HOST=localhost:18443 in the environment.
Reproduction
Add a gh command with --repo to a steps: block in a workflow that starts the DIFC proxy:
steps:
- name: Fetch data
env:
GH_TOKEN: ${{ secrets.MY_PAT }}
run: |
gh issue list --repo owner/other-repo --json number,title > /tmp/issues.json
The step immediately fails with malformed version: because GH_HOST=localhost:18443 (written to $GITHUB_ENV by start_difc_proxy.sh) causes gh to attempt a GHES enterprise version check against the proxy before making any API call.
Root cause
start_difc_proxy.sh contains something equivalent to:
echo "GH_HOST=localhost:18443" >> "$GITHUB_ENV"
This sets GH_HOST for the rest of the job. The gh CLI treats any non-github.com value for GH_HOST as a GitHub Enterprise Server hostname and performs a version validation before API calls made with --repo. The DIFC proxy doesn't implement the GHES version endpoint, so it returns an empty string, which gh rejects as malformed version: .
Workaround
Override GH_HOST at the shell level at the top of the run: script:
GH_HOST=github.com # override proxy-injected GH_HOST; API traffic still routes
# through the proxy via GITHUB_API_URL / GITHUB_GRAPHQL_URL
gh issue list --repo owner/other-repo ...
Note: a step-level env: GH_HOST: github.com in the gh-aw source file has no effect because the gh-aw compiler does not preserve user-defined step env: blocks in the compiled lock file. The override must be inside the run: script.
Expected behaviour
User-defined steps: should be able to use gh --repo commands without a workaround. Either:
start_difc_proxy.sh should not write GH_HOST to $GITHUB_ENV (or should write GH_HOST=github.com), relying on GITHUB_API_URL / GITHUB_GRAPHQL_URL to route API traffic through the proxy, or
- The proxy setup should configure
gh in a way that doesn't require GH_HOST to point at the proxy address for routing to work
Environment
- gh-aw compiler version: v0.76.1
- gh CLI version: 2.79.0
- DIFC proxy image:
ghcr.io/github/gh-aw-mcpg:v0.3.19
Summary
start_difc_proxy.shwritesGH_HOST=localhost:18443to$GITHUB_ENV, which persists to all subsequent steps in the job. AnyghCLI command in a user-definedsteps:block that uses an explicit--repoflag then treats the DIFC proxy as a GitHub Enterprise Server, attempts an enterprise version check against it, receives an empty version string, and exits with:This crashes the step before any real work is done.
Affected scope
ghcommands with an explicit--repo owner/repoflag in user-definedsteps:that run after "Start DIFC Proxy". Commands that omit--repo(relying onGITHUB_REPOSITORY) appear to be unaffected —ghusesGITHUB_API_URLdirectly in that case and skips the host version check.Comparison: A comparable workflow on
fsprojects/FSharp.Datausing the same gh-aw v0.76.1 does NOT reproduce this. Itssteps:usegh issue list --state open ...andgh pr list --state open ...without--repo, which succeed fine even withGH_HOST=localhost:18443in the environment.Reproduction
Add a
ghcommand with--repoto asteps:block in a workflow that starts the DIFC proxy:The step immediately fails with
malformed version:becauseGH_HOST=localhost:18443(written to$GITHUB_ENVbystart_difc_proxy.sh) causesghto attempt a GHES enterprise version check against the proxy before making any API call.Root cause
start_difc_proxy.shcontains something equivalent to:This sets
GH_HOSTfor the rest of the job. TheghCLI treats any non-github.comvalue forGH_HOSTas a GitHub Enterprise Server hostname and performs a version validation before API calls made with--repo. The DIFC proxy doesn't implement the GHES version endpoint, so it returns an empty string, whichghrejects asmalformed version:.Workaround
Override
GH_HOSTat the shell level at the top of therun:script:Note: a step-level
env: GH_HOST: github.comin the gh-aw source file has no effect because the gh-aw compiler does not preserve user-defined stepenv:blocks in the compiled lock file. The override must be inside therun:script.Expected behaviour
User-defined
steps:should be able to usegh --repocommands without a workaround. Either:start_difc_proxy.shshould not writeGH_HOSTto$GITHUB_ENV(or should writeGH_HOST=github.com), relying onGITHUB_API_URL/GITHUB_GRAPHQL_URLto route API traffic through the proxy, orghin a way that doesn't requireGH_HOSTto point at the proxy address for routing to workEnvironment
ghcr.io/github/gh-aw-mcpg:v0.3.19