MCPcopy Create free account
hub / github.com/ddev/ddev / GetGitHubClient

Function GetGitHubClient

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

GetGitHubClient returns a singleton GitHub client and context, initializing it if necessary.

(withAuth bool)

Source from the content-addressed store, hash-verified

33
34// GetGitHubClient returns a singleton GitHub client and context, initializing it if necessary.
35func GetGitHubClient(withAuth bool) (context.Context, *Client) {
36 githubClientOnce.Do(func() {
37 githubContext = context.Background()
38 // Respect proxies set in the environment
39 githubClientNoAuth = github.NewClientWithEnvProxy()
40 githubClient = githubClientNoAuth
41 githubToken, _ := GetGitHubToken()
42 if githubToken != "" {
43 githubClient = githubClient.WithAuthToken(githubToken)
44 }
45 })
46 if withAuth {
47 return githubContext, githubClient
48 }
49 return githubContext, githubClientNoAuth
50}
51
52// GetGitHubRelease gets the tarball URL and version for a GitHub repository release
53func GetGitHubRelease(owner, repo, requestedVersion string) (tarballURL, downloadedRelease string, err error) {

Callers 2

AvailableUpdatesFunction · 0.92
GetGitHubReleaseFunction · 0.85

Calls 1

GetGitHubTokenFunction · 0.85

Tested by

no test coverage detected