MCPcopy Create free account
hub / github.com/cli/cli / mightBeGHESUser

Function mightBeGHESUser

internal/ghcmd/cmd.go:481–494  ·  view source on GitHub ↗
(cfg gh.Config)

Source from the content-addressed store, hash-verified

479}
480
481func mightBeGHESUser(cfg gh.Config) bool {
482 if os.Getenv("GH_ENTERPRISE_TOKEN") != "" || os.Getenv("GITHUB_ENTERPRISE_TOKEN") != "" {
483 return true
484 }
485
486 if host := os.Getenv("GH_HOST"); host != "" && ghauth.IsEnterprise(host) {
487 return true
488 }
489
490 // If any targeted host is Enterprise, then the user is likely a GHES user.
491 return slices.ContainsFunc(cfg.Authentication().Hosts(), func(host string) bool {
492 return ghauth.IsEnterprise(host)
493 })
494}

Callers 2

MainFunction · 0.85
Test_mightBeGHESUserFunction · 0.85

Calls 2

HostsMethod · 0.65
AuthenticationMethod · 0.65

Tested by 1

Test_mightBeGHESUserFunction · 0.68