Skip to content

Commit

Permalink
Lazy load envvar
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Mar 4, 2024
1 parent 0eb7659 commit a044e34
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ let docsSiteBaseUrl = sprintf "https://%s.github.io/%s" gitOwner gitRepoName

let disableCodeCoverage = environVarAsBoolOrDefault "DISABLE_COVERAGE" false

let githubToken = Environment.environVarOrNone "GITHUB_TOKEN"
let githubToken = lazy (Environment.environVarOrNone "GITHUB_TOKEN")


let nugetToken = Environment.environVarOrNone "NUGET_TOKEN"
let nugetToken =
lazy
(Environment.environVarOrNone "NUGET_TOKEN")

//-----------------------------------------------------------------------------
// Helpers
Expand Down Expand Up @@ -557,7 +558,7 @@ let publishToNuget _ =
ToolType = ToolType.CreateLocalTool()
PublishUrl = publishUrl
WorkingDir = "dist"
ApiKey = match nugetToken with
ApiKey = match nugetToken.Value with
| Some s -> s
| _ -> c.ApiKey // assume paket-config was set properly
}
Expand Down Expand Up @@ -587,7 +588,7 @@ let gitRelease _ =
let githubRelease _ =
allReleaseChecks ()
let token =
match githubToken with
match githubToken.Value with
| Some s -> s
| _ -> failwith "please set the github_token environment variable to a github personal access token with repo access."

Expand Down Expand Up @@ -665,8 +666,8 @@ let initTargets () =
//-----------------------------------------------------------------------------
// Hide Secrets in Logger
//-----------------------------------------------------------------------------
Option.iter(TraceSecrets.register "<GITHUB_TOKEN>" ) githubToken
Option.iter(TraceSecrets.register "<NUGET_TOKEN>") nugetToken
Option.iter(TraceSecrets.register "<GITHUB_TOKEN>" ) githubToken.Value
Option.iter(TraceSecrets.register "<NUGET_TOKEN>") nugetToken.Value
//-----------------------------------------------------------------------------
// Target Declaration
//-----------------------------------------------------------------------------
Expand Down

0 comments on commit a044e34

Please sign in to comment.