Skip to content

Commit

Permalink
validate required arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsteves committed Dec 29, 2020
1 parent 75e9638 commit a1a694b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
@@ -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."
Expand Down

0 comments on commit a1a694b

Please sign in to comment.