Skip to content

Commit

Permalink
feat: do not run version check when running in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Zipitria <[email protected]>
  • Loading branch information
fzipi committed May 21, 2023
1 parent 0b4fde2 commit a5bf7f1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package cmd

import (
"fmt"
"os"

"github.com/spf13/cobra"

Expand All @@ -21,12 +22,15 @@ var versionCmd = &cobra.Command{
Long: `All software has versions. This is crs-toolchain's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("crs-toolchain", rootCmd.Version)
latest, err := updater.LatestVersion()
if err != nil {
logger.Error().Err(err).Msg("Failed to check for updates")
} else if latest != "" {
fmt.Println("Latest version is:", latest)
fmt.Println("Run 'crs-toolchain self-update' to update")
// do not run when in CI (e.g. GitHub Actions)
if os.Getenv("CI") != "true" {
latest, err := updater.LatestVersion()
if err != nil {
logger.Error().Err(err).Msg("Failed to check for updates")
} else if latest != "" {
fmt.Println("Latest version is:", latest)
fmt.Println("Run 'crs-toolchain self-update' to update")
}
}
},
}

0 comments on commit a5bf7f1

Please sign in to comment.