diff --git a/astro-client-core/client.go b/astro-client-core/client.go index a4dd64cf3..aec537030 100644 --- a/astro-client-core/client.go +++ b/astro-client-core/client.go @@ -23,6 +23,8 @@ var ( HTTPStatus204 = 204 ) +const TrueString = "true" + // a shorter alias type CoreClient = ClientWithResponsesInterface @@ -60,10 +62,10 @@ func CoreRequestEditor(ctx httpContext.Context, req *http.Request) error { req.URL = requestURL req.Header.Add("authorization", currentCtx.Token) switch { - case os.Getenv("DEPLOY_ACTION") == "true" && os.Getenv("GITHUB_ACTIONS") == "true": + case os.Getenv("DEPLOY_ACTION") == TrueString && os.Getenv("GITHUB_ACTIONS") == TrueString: req.Header.Add("x-astro-client-identifier", "deploy-action") req.Header.Add("x-astro-client-version", os.Getenv("DEPLOY_ACTION_VERSION")) - case os.Getenv("GITHUB_ACTIONS") == "true": + case os.Getenv("GITHUB_ACTIONS") == TrueString: req.Header.Add("x-astro-client-identifier", "github-action") req.Header.Add("x-astro-client-version", version.CurrVersion) default: diff --git a/astro-client-iam-core/client.go b/astro-client-iam-core/client.go index 632d2dd03..5751c3320 100644 --- a/astro-client-iam-core/client.go +++ b/astro-client-iam-core/client.go @@ -23,6 +23,8 @@ var ( HTTPStatus204 = 204 ) +const TrueString = "true" + // a shorter alias type CoreClient = ClientWithResponsesInterface @@ -59,10 +61,10 @@ func CoreRequestEditor(ctx httpContext.Context, req *http.Request) error { req.URL = requestURL req.Header.Add("authorization", currentCtx.Token) switch { - case os.Getenv("DEPLOY_ACTION") == "true" && os.Getenv("GITHUB_ACTIONS") == "true": + case os.Getenv("DEPLOY_ACTION") == TrueString && os.Getenv("GITHUB_ACTIONS") == TrueString: req.Header.Add("x-astro-client-identifier", "deploy-action") req.Header.Add("x-astro-client-version", os.Getenv("DEPLOY_ACTION_VERSION")) - case os.Getenv("GITHUB_ACTIONS") == "true": + case os.Getenv("GITHUB_ACTIONS") == TrueString: req.Header.Add("x-astro-client-identifier", "github-action") req.Header.Add("x-astro-client-version", version.CurrVersion) default: diff --git a/astro-client-platform-core/client.go b/astro-client-platform-core/client.go index b0e3dc2fb..d5dbd1dd0 100644 --- a/astro-client-platform-core/client.go +++ b/astro-client-platform-core/client.go @@ -23,6 +23,8 @@ var ( HTTPStatus204 = 204 ) +const TrueString = "true" + // a shorter alias type CoreClient = ClientWithResponsesInterface @@ -48,10 +50,10 @@ func requestEditor(ctx httpContext.Context, req *http.Request) error { req.URL = requestURL req.Header.Add("authorization", currentCtx.Token) switch { - case os.Getenv("DEPLOY_ACTION") == "true" && os.Getenv("GITHUB_ACTIONS") == "true": + case os.Getenv("DEPLOY_ACTION") == TrueString && os.Getenv("GITHUB_ACTIONS") == TrueString: req.Header.Add("x-astro-client-identifier", "deploy-action") req.Header.Add("x-astro-client-version", os.Getenv("DEPLOY_ACTION_VERSION")) - case os.Getenv("GITHUB_ACTIONS") == "true": + case os.Getenv("GITHUB_ACTIONS") == TrueString: req.Header.Add("x-astro-client-identifier", "github-action") req.Header.Add("x-astro-client-version", version.CurrVersion) default: