-
Notifications
You must be signed in to change notification settings - Fork 322
fix: configure_gh_for_ghe.sh should unset stale GH_HOST on github.com #24217
Copy link
Copy link
Closed
Copy link
Labels
Description
Problem
When configure_gh_for_ghe.sh detects the host is github.com, it returns early without unsetting GH_HOST:
if [ "$github_host" = "github.com" ]; then
echo "Using public GitHub (github.com) - no additional gh configuration needed"
return 0 # ← exits without touching GH_HOST
fiIf GH_HOST was already set in the environment (by a prior step, runner config, or stale state), the early return leaves the stale value in place. When gh pr checkout runs later, it fails with:
none of the git remotes configured for this repository correspond to the GH_HOST environment variable
Triggered by: https://github.com/fsprojects/FSharp.Control.AsyncSeq/actions/runs/23929188570/job/69792652319#step:13:93
Root cause
configure_gh_for_ghe.sh assumes that for github.com, GH_HOST is either unset or correct. But if it has a stale/wrong value, the script does nothing to correct it.
Proposed fix
For github.com, explicitly unset GH_HOST (or set it to github.com) to prevent stale values from breaking downstream gh CLI commands:
if [ "$github_host" = "github.com" ]; then
echo "Using public GitHub (github.com) - no additional gh configuration needed"
# Clear any stale GH_HOST to prevent gh CLI mismatches
if [ -n "${GH_HOST:-}" ] && [ "${GH_HOST}" != "github.com" ]; then
echo "Clearing stale GH_HOST=${GH_HOST}"
echo "GH_HOST=github.com" >> "$GITHUB_ENV"
fi
return 0
fiFiles to modify
actions/setup/sh/configure_gh_for_ghe.sh— Add GH_HOST cleanup for github.com path
Related
Reactions are currently unavailable
Metadata
Metadata
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.