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