Skip to content

Commit

Permalink
more cleanp
Browse files Browse the repository at this point in the history
  • Loading branch information
venkatamutyala committed Oct 14, 2024
1 parent a714c69 commit f1344c8
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions github-workflow-dispatcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@ set -e



# Check if required variables are set
if [ -z "${GITHUB_DISPATCH_URL}" ]; then
echo "Error: GITHUB_DISPATCH_URL is not set."
exit 1
fi
check_variable() {
local var_name=$1
local var_value=${!var_name}

if [ -z "${var_value}" ]; then
echo "Error: ${var_name} is not set."
exit 1
fi
}

# List of required variables
required_vars=("GITHUB_DISPATCH_URL" "GITHUB_TOKEN" "REF_NAME")

# Check each variable
for var in "${required_vars[@]}"; do
check_variable "$var"
done

if [ -z "${REF_NAME}" ]; then
echo "Error: REF_NAME is not set."
exit 1
fi

curl \
--fail \
Expand Down

0 comments on commit f1344c8

Please sign in to comment.