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

Function GetGitHubToken

pkg/github/github.go:136–143  ·  view source on GitHub ↗

GetGitHubToken returns the GitHub token from the environment and the name of the variable it was found in.

()

Source from the content-addressed store, hash-verified

134
135// GetGitHubToken returns the GitHub token from the environment and the name of the variable it was found in.
136func GetGitHubToken() (string, string) {
137 for _, token := range []string{"DDEV_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"} {
138 if githubToken := os.Getenv(token); githubToken != "" {
139 return githubToken, token
140 }
141 }
142 return "", ""
143}
144
145// HasGitHubToken returns true if a GitHub token is set in the environment.
146func HasGitHubToken() bool {

Callers 5

TestGetGitHubTokenFunction · 0.92
GetGitHubClientFunction · 0.85
GetGitHubHeadersFunction · 0.85
HasGitHubTokenFunction · 0.85
HasInvalidGitHubTokenFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGetGitHubTokenFunction · 0.74