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