From dcc61603a2cef8832df6e873443900c3c4453d1c Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 13 Jan 2024 18:03:40 +0100 Subject: [PATCH] actions: add example-tag --- .../example-tag/.forgejo/workflows/test.yml | 21 +++++++++++++++++++ actions/example-tag/run.sh | 19 +++++++++++++++++ actions/run.sh | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 actions/example-tag/.forgejo/workflows/test.yml create mode 100755 actions/example-tag/run.sh diff --git a/actions/example-tag/.forgejo/workflows/test.yml b/actions/example-tag/.forgejo/workflows/test.yml new file mode 100644 index 0000000..c7e1357 --- /dev/null +++ b/actions/example-tag/.forgejo/workflows/test.yml @@ -0,0 +1,21 @@ +on: + push: + tags: + - 'v*' + +jobs: + test: + runs-on: docker + container: + image: code.forgejo.org/oci/node:20-bookworm + volumes: + - /srv/example:/srv/example + steps: + + - name: save event + run: | + d=/srv/example/tag/contexts/$GITHUB_EVENT_NAME + mkdir -p $d + cat > $d/github <<'EOF' + ${{ toJSON(github) }} + EOF diff --git a/actions/example-tag/run.sh b/actions/example-tag/run.sh new file mode 100755 index 0000000..001c303 --- /dev/null +++ b/actions/example-tag/run.sh @@ -0,0 +1,19 @@ +export d=/srv/example/tag + +function main() { + mkdir -p $d + + local repo=root/example-$example + + forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token + local sha=$(forgejo-test-helper.sh branch_tip $url $repo main) + + local api=$url/api/v1 + forgejo-curl.sh api_json --data-raw '{"tag_name":"v1.1","target":"'$sha'"}' $api/repos/$repo/tags + + forgejo-test-helper.sh wait_success $url $repo $sha + + test -f /srv/example/tag/contexts/push/github +} + +main diff --git a/actions/run.sh b/actions/run.sh index 84d7707..b40cc68 100755 --- a/actions/run.sh +++ b/actions/run.sh @@ -35,7 +35,7 @@ function examples_v1_20() { function examples_v1_21() { # keep "cron" last otherwise it will linger and pollute the following runs - echo 'echo push push-cancel artifacts service checkout pull-request container expression local-action context docker-action if if-fail cron' + echo 'echo push tag push-cancel artifacts service checkout pull-request container expression local-action context docker-action if if-fail cron' } function examples_v1_22() {