diff --git a/test/labels-dispatch.test.sh b/test/labels-dispatch.test.sh index 90a1e6c..d7c3bf4 100755 --- a/test/labels-dispatch.test.sh +++ b/test/labels-dispatch.test.sh @@ -136,7 +136,13 @@ check "any non-204 fails, not only the statuses the API documents" 1 "forbidden" run_step_no_api() { rm -rf "${TMP:?}/bin"; mkdir -p "$TMP/bin"; : >"$TMP/calls" make_curl 204 "" - env PATH="$TMP/bin:$PATH" GITHUB_TOKEN=tok GITHUB_REPOSITORY=owner/repo \ + # -u, because plain `env` PRESERVES the parent environment: on the runner + # every step arrives with GITHUB_API_URL set — the premise of the fix under + # test — so without the unset this case inherits it, the refusal path never + # executes, and the case passes only in a dev shell that lacks the variable + # (@kimi-reviewer-andresmgsl, run 468). + env -u GITHUB_API_URL \ + PATH="$TMP/bin:$PATH" GITHUB_TOKEN=tok GITHUB_REPOSITORY=owner/repo \ SWEEP_WORKFLOW=self-labels-sweep.yml DEFAULT_BRANCH=main "$STEP" } check "an unset GITHUB_API_URL refuses rather than guessing GitHub" 1 \