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