MCPcopy Create free account
hub / github.com/github/gh-aw / getGitHubHostForRepo

Function getGitHubHostForRepo

pkg/cli/github.go:25–35  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

23// microsoft/apm/.github/workflows/shared/apm.md) are maintained on github.com.
24// For all other repositories, it uses getGitHubHost().
25func 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}

Calls 2

getGitHubHostFunction · 0.85
PrintfMethod · 0.45

Tested by 1

TestGetGitHubHostForRepoFunction · 0.68