ShouldCheckForExtensionUpdate decides whether we check for updates for GitHub CLI extensions based on user preferences and current execution context. During cli/cli#9934, this logic was split out from ShouldCheckForUpdate() because we envisioned it going in a different direction.
()
| 37 | // ShouldCheckForExtensionUpdate decides whether we check for updates for GitHub CLI extensions based on user preferences and current execution context. |
| 38 | // During cli/cli#9934, this logic was split out from ShouldCheckForUpdate() because we envisioned it going in a different direction. |
| 39 | func ShouldCheckForExtensionUpdate() bool { |
| 40 | if os.Getenv("GH_NO_EXTENSION_UPDATE_NOTIFIER") != "" { |
| 41 | return false |
| 42 | } |
| 43 | if os.Getenv("CODESPACES") != "" { |
| 44 | return false |
| 45 | } |
| 46 | return !ci.IsCI() && IsTerminal(os.Stdout) && IsTerminal(os.Stderr) |
| 47 | } |
| 48 | |
| 49 | // CheckForExtensionUpdate checks whether an update exists for a specific extension based on extension type and recency of last check within past 24 hours. |
| 50 | func CheckForExtensionUpdate(em extensions.ExtensionManager, ext extensions.Extension, now time.Time) (*ReleaseInfo, error) { |