We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a714c69 commit f1344c8Copy full SHA for f1344c8
github-workflow-dispatcher.sh
@@ -3,16 +3,24 @@ set -e
3
4
5
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
+check_variable() {
+ local var_name=$1
+ local var_value=${!var_name}
+
+ 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
23
-if [ -z "${REF_NAME}" ]; then
- echo "Error: REF_NAME is not set."
24
25
curl \
26
--fail \
0 commit comments