ValidateSupportedHost rejects hosts that are not supported. Supported hosts are github.com and GHEC with data residency (*.ghe.com). GitHub Enterprise Server is not currently supported.
(host string)
| 54 | // Supported hosts are github.com and GHEC with data residency (*.ghe.com). |
| 55 | // GitHub Enterprise Server is not currently supported. |
| 56 | func ValidateSupportedHost(host string) error { |
| 57 | host = normalizeHost(host) |
| 58 | if host == "" { |
| 59 | return fmt.Errorf("could not determine repository host") |
| 60 | } |
| 61 | if host == SupportedHost || ghauth.IsTenancy(host) { |
| 62 | return nil |
| 63 | } |
| 64 | if ghauth.IsEnterprise(host) { |
| 65 | return fmt.Errorf("GitHub Skills does not currently support GitHub Enterprise Server; got %s", host) |
| 66 | } |
| 67 | return fmt.Errorf("unsupported host for GitHub Skills: %s", host) |
| 68 | } |
| 69 | |
| 70 | func normalizeHost(host string) string { |
| 71 | host = strings.TrimSpace(strings.ToLower(host)) |