From d772474759931380a7e02d598bf8ee9bda91d0ed Mon Sep 17 00:00:00 2001 From: username Date: Wed, 20 Dec 2023 16:46:33 +0100 Subject: [PATCH] actions/example-cron: branch creation must not impact the default --- .forgejo/workflows/actions.yml | 2 +- actions/example-cron/run.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/actions.yml b/.forgejo/workflows/actions.yml index 5024749..383eed3 100644 --- a/.forgejo/workflows/actions.yml +++ b/.forgejo/workflows/actions.yml @@ -13,7 +13,7 @@ jobs: - binary: https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 version: v1_22 tests: ${{ vars.V1_22_TESTS }} - - binary: https://codeberg.org/forgejo/forgejo/releases/download/v1.21.2-1/forgejo-1.21.2-1-linux-amd64 + - binary: https://codeberg.org/forgejo/forgejo/releases/download/v1.21.3-0/forgejo-1.21.3-0-linux-amd64 version: v1_21 tests: ${{ vars.V1_21_TESTS }} - binary: https://codeberg.org/forgejo/forgejo/releases/download/v1.20.6-1/forgejo-1.20.6-1-linux-amd64 diff --git a/actions/example-cron/run.sh b/actions/example-cron/run.sh index b855cc5..3ced64c 100755 --- a/actions/example-cron/run.sh +++ b/actions/example-cron/run.sh @@ -1,4 +1,20 @@ forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token + +# +# Verify that creating a new branch with the same SHA as the default branch +# does not change the ref associated with the schedule +# +# See https://codeberg.org/forgejo/forgejo/pulls/1941 for more information +# +function verify_ref() { + local ref=$(sqlite3 $DIR/forgejo-work-path/forgejo.db 'select ref from action_schedule') + test "${ref##*/}" = "main" +} +verify_ref +api=$url/api/v1 +forgejo-curl.sh api_json --data '{"new_branch_name":"zzzz"}' $api/repos/root/example-cron/branches +verify_ref + # cron runs once per minute, give it three minutes max before declaring failure if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example-cron-volume/DONE ; then cat $FORGEJO_RUNNER_LOGS