From 197d6b076702b39117df47073b15a2423d480a0a Mon Sep 17 00:00:00 2001 From: Pikachu920 <28607612+Pikachu920@users.noreply.github.com> Date: Sat, 8 Jun 2024 12:29:10 -0500 Subject: [PATCH] Properly guard against missing input --- run-tests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/run-tests.py b/run-tests.py index f0849b1..695d9cd 100644 --- a/run-tests.py +++ b/run-tests.py @@ -33,7 +33,7 @@ class EnvironmentResource(TypedDict): skript_repo_ref = os.environ.get("INPUT_SKRIPT_REPO_REF", None) run_vanilla_tests = os.environ.get("INPUT_RUN_VANILLA_TESTS", None) == "true" jdk_version = os.environ.get("INPUT_JDK_VERSION", None) -if jdk_version is not None and not jdk_version.isspace(): +if jdk_version is not None and jdk_version != "" and not jdk_version.isspace(): sdkman_use_process = run_sdkman_command(("sdk", "default", "java", jdk_version)) if sdkman_use_process.returncode != 0: sdkman_install_process = run_sdkman_command(("yes", "|", "sdk", "install", "java", jdk_version)) @@ -45,9 +45,9 @@ class EnvironmentResource(TypedDict): skript_test_directory = skript_repo_path / "src" / "test" / "skript" / "tests" custom_test_directory = skript_test_directory / "custom" extra_plugins_directory = None -extra_plugins_directory_string = os.environ.get("INPUT_EXTRA_PLUGINS_DIRECTORY", None) -if extra_plugins_directory_string is not None and extra_plugins_directory_string != "": - extra_plugins_directory = github_workspace_directory / extra_plugins_directory_string +extra_plugins_directory_input = os.environ.get("INPUT_EXTRA_PLUGINS_DIRECTORY", None) +if extra_plugins_directory_input is not None and extra_plugins_directory_input != "" and not extra_plugins_directory_input.isspace(): + extra_plugins_directory = github_workspace_directory / extra_plugins_directory_input print("Configuration:") print(f" Test script directory: {test_script_directory}")