parseGitHubURL extracts owner/repo from a GitHub remote URL. Only github.com and GHEC data residency (*.ghe.com) URLs are recognized.
(rawURL string)
| 970 | // parseGitHubURL extracts owner/repo from a GitHub remote URL. |
| 971 | // Only github.com and GHEC data residency (*.ghe.com) URLs are recognized. |
| 972 | func parseGitHubURL(rawURL string) (ghrepo.Interface, error) { |
| 973 | u, err := git.ParseURL(rawURL) |
| 974 | if err != nil { |
| 975 | return nil, nil //nolint:nilerr // unparseable URL means it's not a GitHub remote |
| 976 | } |
| 977 | r, err := ghrepo.FromURL(u) |
| 978 | if err != nil { |
| 979 | return nil, nil //nolint:nilerr // URL didn't match GitHub repo format |
| 980 | } |
| 981 | if err := source.ValidateSupportedHost(r.RepoHost()); err != nil { |
| 982 | return nil, nil //nolint:nilerr // non-GitHub host is silently ignored |
| 983 | } |
| 984 | return r, nil |
| 985 | } |
| 986 | |
| 987 | // detectMissingRepoDiagnostic explains why remote checks were skipped. |
| 988 | func detectMissingRepoDiagnostic(gitClient *git.Client, dir string) []publishDiagnostic { |
no test coverage detected