parseGitHubURL extracts owner/repo from a GitHub remote URL. Only github.com and GHEC data residency (*.ghe.com) URLs are recognized.
(rawURL string)
| 1004 | // parseGitHubURL extracts owner/repo from a GitHub remote URL. |
| 1005 | // Only github.com and GHEC data residency (*.ghe.com) URLs are recognized. |
| 1006 | func parseGitHubURL(rawURL string) (ghrepo.Interface, error) { |
| 1007 | u, err := git.ParseURL(rawURL) |
| 1008 | if err != nil { |
| 1009 | return nil, nil //nolint:nilerr // unparsable URL means it's not a GitHub remote |
| 1010 | } |
| 1011 | r, err := ghrepo.FromURL(u) |
| 1012 | if err != nil { |
| 1013 | return nil, nil //nolint:nilerr // URL didn't match GitHub repo format |
| 1014 | } |
| 1015 | if err := source.ValidateSupportedHost(r.RepoHost()); err != nil { |
| 1016 | return nil, nil //nolint:nilerr // non-GitHub host is silently ignored |
| 1017 | } |
| 1018 | return r, nil |
| 1019 | } |
| 1020 | |
| 1021 | // detectMissingRepoDiagnostic explains why remote checks were skipped. |
| 1022 | func detectMissingRepoDiagnostic(gitClient *git.Client, dir string) []publishDiagnostic { |
no test coverage detected