From a1a694bdb854ceb40fc4e6d77af5026ee397cc64 Mon Sep 17 00:00:00 2001 From: Jacob Steves Date: Tue, 29 Dec 2020 09:50:20 -0500 Subject: [PATCH] validate required arguments --- run.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index af917b6..5fad24c 100644 --- a/run.sh +++ b/run.sh @@ -1,8 +1,13 @@ #!/bin/bash -if [ -n $INPUT_TARBALL ]; then +if [[ -z ${INPUT_SERVER} ]] || [[ -z ${INPUT_PASSWORD} ]] || [[ -z ${INPUT_APPNAME} ]]; then + echo "Invalid input. Some required arguments missing." + exit 1 +fi + +if [[ ! -z ${INPUT_TARBALL} ]]; then caprover deploy -h $INPUT_SERVER -p $INPUT_PASSWORD -a $INPUT_APPNAME -t $INPUT_TARBALL -elif [ -n $INPUT_BRANCH ]; then +elif [[ ! -z ${INPUT_BRANCH} ]]; then caprover deploy -h $INPUT_SERVER -p $INPUT_PASSWORD -a $INPUT_APPNAME -b $INPUT_BRANCH else echo "Invalid input. Either a tarball or a branch argument is required."