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 | |
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')
3 files changed, 36 insertions, 0 deletions
diff --git a/pkg/runner/testdata/actions-environment-and-context-tests/docker/Dockerfile b/pkg/runner/testdata/actions-environment-and-context-tests/docker/Dockerfile new file mode 100644 index 0000000..bd8fcb2 --- /dev/null +++ b/pkg/runner/testdata/actions-environment-and-context-tests/docker/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3 + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/pkg/runner/testdata/actions-environment-and-context-tests/docker/action.yml b/pkg/runner/testdata/actions-environment-and-context-tests/docker/action.yml new file mode 100644 index 0000000..0b0b9f0 --- /dev/null +++ b/pkg/runner/testdata/actions-environment-and-context-tests/docker/action.yml @@ -0,0 +1,5 @@ +name: 'Test' +description: 'Test' +runs: + using: 'docker' + image: 'Dockerfile' 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 |