NormalizeRepoForAPI splits a repo string of the form "[HOST/]owner/repo" into the owner/repo portion and an optional host. Most callers pass plain "owner/repo", but GHES and Proxima installs may supply "HOST/owner/repo".
(repo string)
| 27 | // the owner/repo portion and an optional host. Most callers pass plain |
| 28 | // "owner/repo", but GHES and Proxima installs may supply "HOST/owner/repo". |
| 29 | func NormalizeRepoForAPI(repo string) (ownerRepo string, host string) { |
| 30 | parts := strings.SplitN(repo, "/", 3) |
| 31 | if len(parts) == 3 { |
| 32 | return parts[1] + "/" + parts[2], parts[0] |
| 33 | } |
| 34 | return repo, "" |
| 35 | } |
no outgoing calls