From 77c7e0543b4ca6854e7b3a59277dbba4bcbcc71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Kwiecin=CC=81ski?= Date: Sun, 26 May 2024 15:21:28 +0200 Subject: [PATCH] Fail if input not recognised --- entrypoint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/entrypoint.py b/entrypoint.py index a22b62d..7babf1a 100644 --- a/entrypoint.py +++ b/entrypoint.py @@ -49,8 +49,10 @@ def github_output(key, value): latest_beta = all_beta[-1] latest_rc = all_rc[-1] -version_to_resolve = os.getenv("INPUT_VERSION_TO_RESOLVE", "") -if version_to_resolve in ["stable", "current"]: +version_to_resolve = os.getenv("INPUT_VERSION_TO_RESOLVE", "").strip() +if version_to_resolve == "": + resolved_version = "" +elif version_to_resolve in ["stable", "current"]: resolved_version = latest_stable elif version_to_resolve == "alpha": resolved_version = latest_alpha @@ -59,7 +61,7 @@ def github_output(key, value): elif version_to_resolve in ["release-candidate", "rc"]: resolved_version = latest_rc else: - resolved_version = "" + raise Exception("Unrecognised `version-to-resolve` input value. Has to be one of [`stable`, `alpha`, `beta`, `rc`]") github_output(key="latest-stable", value=latest_stable) github_output(key="latest-alpha", value=latest_alpha)