X Tutup
Skip to content

Commit 3a22ab7

Browse files
committed
Update shouldCheckForUpdate
1 parent 0d593e7 commit 3a22ab7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cmd/gh/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ func printError(out io.Writer, err error, cmd *cobra.Command, debug bool) {
186186
}
187187

188188
func shouldCheckForUpdate() bool {
189-
return updaterEnabled != "" && !isCompletionCommand() && utils.IsTerminal(os.Stderr)
189+
isCIEnvironment := (os.Getenv("CI") != "") || (os.Getenv("BUILD_NUMBER") != "") || (os.Getenv("RUN_ID") != "")
190+
isGlobalDisabled := os.Getenv("GH_NO_UPDATE_NOTIFIER") == "disabled"
191+
return updaterEnabled != "" && !isCompletionCommand() && utils.IsTerminal(os.Stderr) && !isCIEnvironment && !isGlobalDisabled
190192
}
191193

192194
func isCompletionCommand() bool {

internal/config/config_type.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import (
1111
)
1212

1313
const (
14-
defaultGitProtocol = "https"
15-
PromptsDisabled = "disabled"
16-
PromptsEnabled = "enabled"
14+
defaultGitProtocol = "https"
15+
PromptsDisabled = "disabled"
16+
PromptsEnabled = "enabled"
17+
UpdateCheckEnabled = "enabled"
18+
UpdateCheckDisabled = "disabled"
1719
)
1820

1921
// This interface describes interacting with some persistent configuration for gh.

0 commit comments

Comments
 (0)
X Tutup