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
(owner, repo string)
| 47 | // microsoft/apm/.github/workflows/shared/apm.md) are maintained on github.com. |
| 48 | // For all other repositories, it uses GetGitHubHost(). |
| 49 | func GetGitHubHostForRepo(owner, repo string) string { |
| 50 | switch owner { |
| 51 | case "github", "githubnext", "microsoft": |
| 52 | githubLog.Printf("Using public GitHub host for %s/%s repository in %s organization", owner, repo, owner) |
| 53 | return string(constants.PublicGitHubHost) |
| 54 | } |
| 55 | |
| 56 | // For all other repositories, use the configured GitHub host |
| 57 | return GetGitHubHost() |
| 58 | } |
| 59 | |
| 60 | // GetGitHubToken attempts to get GitHub token from environment or gh CLI |
| 61 | func GetGitHubToken() (string, error) { |