Skip to content

Commit

Permalink
specify new GITHUB_LIMIT_USER_OWNED and allow y/yes as valid options …
Browse files Browse the repository at this point in the history
…to set a boolean env var to true.
  • Loading branch information
jonhadfield committed Mar 13, 2024
1 parent 6c30b0f commit 80cb7b1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const (
envGitHubToken = "GITHUB_TOKEN"
envGitHubOrgs = "GITHUB_ORGS"
envGitHubSkipUserRepos = "GITHUB_SKIP_USER_REPOS"
envGitHubLimitUserOwned = "GITHUB_LIMIT_USER_OWNED"
envGitHubCompare = "GITHUB_COMPARE"
envGitLabBackups = "GITLAB_BACKUPS"
envGitLabMinAccessLevel = "GITLAB_PROJECT_MIN_ACCESS_LEVEL"
Expand Down Expand Up @@ -233,6 +234,15 @@ func main() {
}

func envTrue(envVar string) bool {
val := os.Getenv(envVar)
if val == "" {
return false
}

if strings.EqualFold(val, "yes") || strings.EqualFold(val, "y") {
return true
}

res, err := strconv.ParseBool(os.Getenv(envVar))
if err != nil {
return false
Expand Down

0 comments on commit 80cb7b1

Please sign in to comment.