MCPcopy Create free account
hub / github.com/mroth/bump / defaultGithubClient

Function defaultGithubClient

github.go:59–70  ·  view source on GitHub ↗

defaultGithubClient returns a OAuth scoped Github API Client if GITHUB_TOKEN is set the local environment, or an unauthorized one otherwise.

()

Source from the content-addressed store, hash-verified

57// defaultGithubClient returns a OAuth scoped Github API Client if GITHUB_TOKEN
58// is set the local environment, or an unauthorized one otherwise.
59func defaultGithubClient() *github.Client {
60 token, ok := os.LookupEnv("GITHUB_TOKEN")
61 if ok {
62 ctx := context.Background()
63 ts := oauth2.StaticTokenSource(
64 &oauth2.Token{AccessToken: token},
65 )
66 tc := oauth2.NewClient(ctx, ts)
67 return github.NewClient(tc)
68 }
69 return github.NewClient(nil)
70}

Callers 2

getLatestReleaseFunction · 0.85
compareReleaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…