From 5cdebe65db3e228b8d097740c4f13793f814d8df Mon Sep 17 00:00:00 2001 From: username Date: Wed, 20 Dec 2023 16:46:33 +0100 Subject: [PATCH] actions/example-cron: verify the type of the event --- actions/example-cron/.forgejo/workflows/test.yml | 8 ++++++++ actions/example-cron/run.sh | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/actions/example-cron/.forgejo/workflows/test.yml b/actions/example-cron/.forgejo/workflows/test.yml index 5f9a843..2eedd14 100644 --- a/actions/example-cron/.forgejo/workflows/test.yml +++ b/actions/example-cron/.forgejo/workflows/test.yml @@ -12,3 +12,11 @@ jobs: steps: - run: | touch /srv/example/cron-volume/DONE + + - name: save context + run: | + d=/srv/example/cron/contexts/$GITHUB_EVENT_NAME + mkdir -p $d + cat > $d/github <<'EOF' + ${{ toJSON(github) }} + EOF diff --git a/actions/example-cron/run.sh b/actions/example-cron/run.sh index c0dc193..f95045f 100755 --- a/actions/example-cron/run.sh +++ b/actions/example-cron/run.sh @@ -20,3 +20,8 @@ if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example/cron cat $FORGEJO_RUNNER_LOGS false fi + +c=/srv/example/cron/contexts/schedule/github +cat $c +test "schedule" = "$(jq -r .event_name < $c)" +test "schedule" = "$(jq -r .event.action < $c)"