MCPcopy Create free account
hub / github.com/cli/cli / ShouldCheckForUpdate

Function ShouldCheckForUpdate

internal/update/update.go:82–90  ·  view source on GitHub ↗

ShouldCheckForUpdate decides whether we check for updates for the GitHub CLI based on user preferences and current execution context.

()

Source from the content-addressed store, hash-verified

80
81// ShouldCheckForUpdate decides whether we check for updates for the GitHub CLI based on user preferences and current execution context.
82func ShouldCheckForUpdate() bool {
83 if os.Getenv("GH_NO_UPDATE_NOTIFIER") != "" {
84 return false
85 }
86 if os.Getenv("CODESPACES") != "" {
87 return false
88 }
89 return !ci.IsCI() && IsTerminal(os.Stdout) && IsTerminal(os.Stderr)
90}
91
92// CheckForUpdate checks whether an update exists for the GitHub CLI based on recency of last check within past 24 hours.
93func CheckForUpdate(ctx context.Context, client *http.Client, stateFilePath, repo, currentVersion string) (*ReleaseInfo, error) {

Callers 2

checkForUpdateFunction · 0.92
TestShouldCheckForUpdateFunction · 0.85

Calls 2

IsCIFunction · 0.92
IsTerminalFunction · 0.85

Tested by 1

TestShouldCheckForUpdateFunction · 0.68