Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmd/gh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,17 @@ func printError(out io.Writer, err error, cmd *cobra.Command, debug bool) {
}

func shouldCheckForUpdate() bool {
return updaterEnabled != "" && !isCompletionCommand() && utils.IsTerminal(os.Stderr)
if os.Getenv("GH_NO_UPDATE_NOTIFIER") != "" {
return false
}
return updaterEnabled != "" && !isCI() && !isCompletionCommand() && utils.IsTerminal(os.Stderr)
}

// based on https://github.com/watson/ci-info/blob/HEAD/index.js
func isCI() bool {
return os.Getenv("CI") != "" || // GitHub Actions, Travis CI, CircleCI, Cirrus CI, GitLab CI, AppVeyor, CodeShip, dsari
os.Getenv("BUILD_NUMBER") != "" || // Jenkins, TeamCity
os.Getenv("RUN_ID") != "" // TaskCluster, dsari
}

func isCompletionCommand() bool {
Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/root/help_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func NewHelpTopic(topic string) *cobra.Command {

CLICOLOR_FORCE: set to a value other than "0" to keep ANSI colors in output
even when the output is piped.

GH_NO_UPDATE_NOTIFIER: set to any value to disable update notifications. By default, gh
checks for new releases once every 24 hours and displays an upgrade notice on standard
error if a newer version was found.
`)

cmd := &cobra.Command{
Expand Down