SetGHHostEnv sets the GH_HOST environment variable on the command for non-github.com hosts. This is needed for GitHub Enterprise Server (GHES) and Proxima (data residency) instances because commands like `gh repo view`, `gh pr create`, and `gh run view` do not accept a --hostname flag (unlike `gh ap
(cmd *exec.Cmd, host string)
| 233 | // because commands like `gh repo view`, `gh pr create`, and `gh run view` do not accept a |
| 234 | // --hostname flag (unlike `gh api` which does). |
| 235 | func SetGHHostEnv(cmd *exec.Cmd, host string) { |
| 236 | if host == "" || host == "github.com" { |
| 237 | return |
| 238 | } |
| 239 | if cmd.Env == nil { |
| 240 | cmd.Env = append(os.Environ(), "GH_HOST="+host) |
| 241 | } else { |
| 242 | cmd.Env = append(cmd.Env, "GH_HOST="+host) |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | // ForceGHHostEnv forces GH_HOST=<host> on the command's environment, overriding |
| 247 | // any GH_HOST already present in the process environment or cmd.Env. |
no outgoing calls