summaryrefslogtreecommitdiffstats
path: root/pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2025-01-24 09:00:09 +0100
committerDaniel Baumann <daniel@debian.org>2025-01-24 09:00:09 +0100
commit4bf4dabd48aa70da3699b9a023f22689645d24f4 (patch)
treeed8175444649e71c0ed0e5f1d30101786ca2473e /pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh
parentInitial commit. (diff)
downloadforgejo-act-upstream.tar.xz
forgejo-act-upstream.zip
Adding upstream version 1.24.0.HEADupstream/1.24.0upstreamdebian
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh')
-rwxr-xr-xpkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh b/pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh
new file mode 100755
index 0000000..a954fd4
--- /dev/null
+++ b/pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+checkEnvVar() {
+ name=$1
+ value=$2
+ allowEmpty=$3
+
+ if [ -z "$value" ]; then
+ echo "Missing environment variable: $name"
+ exit 1
+ fi
+
+ if [ "$allowEmpty" != "true" ]; then
+ test=$(echo "$value" |cut -f 2 -d "=")
+ if [ -z "$test" ]; then
+ echo "Environment variable is empty: $name"
+ exit 1
+ fi
+ fi
+
+ echo "$value"
+}
+
+checkEnvVar "GITHUB_ACTION" "$(env |grep "GITHUB_ACTION=")" false
+checkEnvVar "GITHUB_ACTION_REPOSITORY" "$(env |grep "GITHUB_ACTION_REPOSITORY=")" true
+checkEnvVar "GITHUB_ACTION_REF" "$(env |grep "GITHUB_ACTION_REF=")" true