mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-02-18 07:50:53 +00:00
feat: go 1.25.5, dependency updates, renamed internal/errors (#129)
* feat: rename internal/errors to internal/apperrors * fix(tests): clear env values before using in tests * feat: rename internal/errors to internal/apperrors * chore(deps): update go and all dependencies * chore: remove renovate from pre-commit, formatting * chore: sonarcloud fixes * feat: consolidate constants to appconstants/constants.go * chore: sonarcloud fixes * feat: simplification, deduplication, test utils * chore: sonarcloud fixes * chore: sonarcloud fixes * chore: sonarcloud fixes * chore: sonarcloud fixes * chore: clean up * fix: config discovery, const deduplication * chore: fixes
This commit is contained in:
25
internal/github_helper.go
Normal file
25
internal/github_helper.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/ivuorinen/gh-action-readme/appconstants"
|
||||
)
|
||||
|
||||
// loadGitHubTokenFromEnv retrieves the GitHub token from environment variables.
|
||||
// It checks both the tool-specific environment variable (GHREADME_GITHUB_TOKEN)
|
||||
// and the standard GitHub environment variable (GITHUB_TOKEN) in that order.
|
||||
// Returns an empty string if no token is found.
|
||||
func loadGitHubTokenFromEnv() string {
|
||||
// Priority 1: Tool-specific env var
|
||||
if token := os.Getenv(appconstants.EnvGitHubToken); token != "" {
|
||||
return token
|
||||
}
|
||||
|
||||
// Priority 2: Standard GitHub env var
|
||||
if token := os.Getenv(appconstants.EnvGitHubTokenStandard); token != "" {
|
||||
return token
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user