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