MCPcopy Create free account
hub / github.com/github/gh-aw / RunGHContextWithHost

Function RunGHContextWithHost

pkg/workflow/github_cli.go:214–229  ·  view source on GitHub ↗

RunGHContextWithHost executes a gh CLI command with context support, a spinner, and an explicit GitHub host.

(ctx context.Context, spinnerMessage string, host string, args ...string)

Source from the content-addressed store, hash-verified

212// RunGHContextWithHost executes a gh CLI command with context support, a spinner,
213// and an explicit GitHub host.
214func RunGHContextWithHost(ctx context.Context, spinnerMessage string, host string, args ...string) ([]byte, error) {
215 cmd := ExecGHContext(ctx, args...)
216 SetGHHostEnv(cmd, host)
217
218 if tty.IsStderrTerminal() {
219 spinner := console.NewSpinner(spinnerMessage)
220 spinner.Start()
221 output, err := cmd.Output()
222 err = enrichGHError(err)
223 spinner.Stop()
224 return output, err
225 }
226
227 output, err := cmd.Output()
228 return output, enrichGHError(err)
229}
230
231// SetGHHostEnv sets the GH_HOST environment variable on the command for non-github.com hosts.
232// This is needed for GitHub Enterprise Server (GHES) and Proxima (data residency) instances

Callers 1

addLabelToOrgPRFunction · 0.92

Calls 7

IsStderrTerminalFunction · 0.92
NewSpinnerFunction · 0.92
SetGHHostEnvFunction · 0.85
enrichGHErrorFunction · 0.85
ExecGHContextFunction · 0.70
StartMethod · 0.45
StopMethod · 0.45

Tested by

no test coverage detected