Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTokenFromEnv ¶
GetTokenFromEnv returns a GitHub token based on the following precedence order:
- If tokenValue is non-empty, it is returned.
- Otherwise, if the GITHUB_TOKEN environment variable is set, its value is returned.
- Otherwise, if the GH_TOKEN environment variable is set, its value is returned.
- If none of the above are set, an empty string is returned.
Example:
os.Setenv("GITHUB_TOKEN", "abc")
os.Setenv("GH_TOKEN", "def")
GetTokenFromEnv("xyz") // returns "xyz"
GetTokenFromEnv("") // returns "abc"
os.Unsetenv("GITHUB_TOKEN")
GetTokenFromEnv("") // returns "def"
os.Unsetenv("GH_TOKEN")
GetTokenFromEnv("") // returns ""
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.