diff options
author | Daniel Baumann <daniel@debian.org> | 2025-01-24 09:00:09 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2025-01-24 09:00:09 +0100 |
commit | 4bf4dabd48aa70da3699b9a023f22689645d24f4 (patch) | |
tree | ed8175444649e71c0ed0e5f1d30101786ca2473e /pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh | |
parent | Initial commit. (diff) | |
download | forgejo-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-x | pkg/runner/testdata/actions-environment-and-context-tests/docker/entrypoint.sh | 26 |
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 |