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