File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -565,7 +565,7 @@ func installDependenciesAndBuild() {
565565 // Go tooling should install required Go versions as needed.
566566 if toolchain .GetEnvGoSemVer ().IsOlderThan (toolchain .V1_21 ) && greatestGoVersion != nil && greatestGoVersion .IsNewerThan (toolchain .GetEnvGoSemVer ()) {
567567 diagnostics .EmitNewerGoVersionNeeded (toolchain .GetEnvGoSemVer ().String (), greatestGoVersion .String ())
568- if val , _ := os . LookupEnv ( "GITHUB_ACTIONS" ); val == "true" {
568+ if util . IsActionsWorkflow () {
569569 log .Printf (
570570 "A go.mod file requires version %s of Go, but version %s is installed. Consider adding an actions/setup-go step to your workflow.\n " ,
571571 greatestGoVersion ,
Original file line number Diff line number Diff line change @@ -313,6 +313,12 @@ func IsGolangVendorDirectory(dirPath string) bool {
313313 fileExists (filepath .Join (dirPath , "../vendor.conf" )))
314314}
315315
316+ // Returns true if the `GITHUB_ACTIONS` environment variable is set to `true`.
317+ // This is the case in GitHub Actions workflows.
318+ func IsActionsWorkflow () bool {
319+ return os .Getenv ("GITHUB_ACTIONS" ) == "true"
320+ }
321+
316322// Returns true if the `GITHUB_EVENT_NAME` environment variable is set and suggests that
317323// we are running in a GitHub Actions workflow that was triggered by the `dynamic` event.
318324// This is the case for e.g. Default Setup.
You can’t perform that action at this time.
0 commit comments