Skip to content

Commit f1344c8

Browse files
more cleanp
1 parent a714c69 commit f1344c8

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

github-workflow-dispatcher.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,24 @@ set -e
33

44

55

6-
# Check if required variables are set
7-
if [ -z "${GITHUB_DISPATCH_URL}" ]; then
8-
echo "Error: GITHUB_DISPATCH_URL is not set."
9-
exit 1
10-
fi
6+
check_variable() {
7+
local var_name=$1
8+
local var_value=${!var_name}
9+
10+
if [ -z "${var_value}" ]; then
11+
echo "Error: ${var_name} is not set."
12+
exit 1
13+
fi
14+
}
15+
16+
# List of required variables
17+
required_vars=("GITHUB_DISPATCH_URL" "GITHUB_TOKEN" "REF_NAME")
18+
19+
# Check each variable
20+
for var in "${required_vars[@]}"; do
21+
check_variable "$var"
22+
done
1123

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

1725
curl \
1826
--fail \

0 commit comments

Comments
 (0)