From 1f6520ac0205d22c39219ff06b62cd4022778f90 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Thu, 17 Feb 2022 18:08:02 +0100 Subject: [PATCH] bundles/sshmon: ignore prereleases and drafts --- .../sshmon/files/check_github_for_new_release | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bundles/sshmon/files/check_github_for_new_release b/bundles/sshmon/files/check_github_for_new_release index e1e1fe8..3a50d94 100644 --- a/bundles/sshmon/files/check_github_for_new_release +++ b/bundles/sshmon/files/check_github_for_new_release @@ -37,9 +37,10 @@ try: for i in releases: if i["tag_name"].startswith(tag_prefix): - if newest_release is None or parse(i["tag_name"]) > parse( - newest_release["tag_name"] - ): + if ( + newest_release is None + or parse(i["tag_name"]) > parse(newest_release["tag_name"]) + ) and not (i["prerelease"] or i["draft"]): newest_release = i assert newest_release is not None, "Could not determine latest release" @@ -50,16 +51,13 @@ try: newest_release["tag_name"], current_version ) ) - - if newest_release["prerelease"] or newest_release["draft"]: - print("Please note this is only a prerelease/draft.") - - # Don't alert people for prereleases. - exit(0) - else: - exit(2) + exit(2) else: - print("Currently installed version {} matches newest release on github".format(current_version)) + print( + "Currently installed version {} matches newest release on github".format( + current_version + ) + ) exit(0) except Exception as e: print(repr(e))