File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -26,19 +26,23 @@ def cli(ctx, verbose) -> None:
2626 ctx .ensure_object (dict )
2727 ctx .obj ["VERBOSE" ] = verbose
2828 current_version = Version .parse_version_string (__version__ )
29- tags = requests .get ("https://api.github.com/repos/git-mastery/app/tags" ).json ()
30- latest_version = Version .parse_version_string (tags [0 ]["name" ])
31- if current_version .is_behind (latest_version ):
32- warn (
33- click .style (
34- f"Your version of Git-Mastery app { current_version } is behind the latest version { latest_version } ." ,
35- fg = "bright_red" ,
29+ req = requests .get ("https://api.github.com/repos/git-mastery/app/tags" )
30+ if req .ok :
31+ # Only continue with checks if request succeeds
32+ # Request could fail due to Github API rate limits or other errors
33+ tags = req .json ()
34+ latest_version = Version .parse_version_string (tags [0 ]["name" ])
35+ if current_version .is_behind (latest_version ):
36+ warn (
37+ click .style (
38+ f"Your version of Git-Mastery app { current_version } is behind the latest version { latest_version } ." ,
39+ fg = "bright_red" ,
40+ )
41+ )
42+ warn ("We strongly recommend upgrading your app." )
43+ warn (
44+ f"Follow the update guide here: { click .style ('https://git-mastery.github.io/app/update' , bold = True )} "
3645 )
37- )
38- warn ("We strongly recommend upgrading your app." )
39- warn (
40- f"Follow the update guide here: { click .style ('https://git-mastery.github.io/app/update' , bold = True )} "
41- )
4246
4347
4448def start () -> None :
You can’t perform that action at this time.
0 commit comments