isGitHubURL checks if the given URL is for GitHub or any subdomain of GitHub
(requestURL string)
| 121 | |
| 122 | // isGitHubURL checks if the given URL is for GitHub or any subdomain of GitHub |
| 123 | func isGitHubURL(requestURL string) bool { |
| 124 | if requestURL == "" { |
| 125 | return false |
| 126 | } |
| 127 | u, err := url.Parse(requestURL) |
| 128 | if err != nil { |
| 129 | return false |
| 130 | } |
| 131 | host := strings.ToLower(u.Host) |
| 132 | return host == "github.com" || strings.HasSuffix(host, ".github.com") |
| 133 | } |
| 134 | |
| 135 | // GetGitHubToken returns the GitHub token from the environment and the name of the variable it was found in. |
| 136 | func GetGitHubToken() (string, string) { |
no outgoing calls
no test coverage detected