getGitHubHostForRepo returns the GitHub host URL for a specific repository. Repositories under the github, githubnext, and microsoft organizations are fetched from public GitHub (https://github.com) in cross-host contexts. microsoft/* is included because canonical shared workflows (for example micro
(repo string)
| 23 | // microsoft/apm/.github/workflows/shared/apm.md) are maintained on github.com. |
| 24 | // For all other repositories, it uses getGitHubHost(). |
| 25 | func getGitHubHostForRepo(repo string) string { |
| 26 | parts := strings.SplitN(repo, "/", 2) |
| 27 | switch parts[0] { |
| 28 | case "github", "githubnext", "microsoft": |
| 29 | githubLog.Printf("Using public GitHub host for %s organization repository", parts[0]) |
| 30 | return string(constants.PublicGitHubHost) |
| 31 | } |
| 32 | |
| 33 | // For all other repositories, use the configured GitHub host |
| 34 | return getGitHubHost() |
| 35 | } |