From 80cb7b1ab98bde1e4c61d99bb470059d661952b7 Mon Sep 17 00:00:00 2001 From: Jon Hadfield Date: Wed, 13 Mar 2024 17:51:39 +0000 Subject: [PATCH] specify new GITHUB_LIMIT_USER_OWNED and allow y/yes as valid options to set a boolean env var to true. --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index 4f22c93..a836582 100644 --- a/main.go +++ b/main.go @@ -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" @@ -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