end-to-end/actions/example-post-7-0-schedule/run.sh
2024-08-07 08:31:33 +02:00

30 lines
1.2 KiB
Bash
Executable file

forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
forgejo-curl.sh web -X POST http://${HOST_PORT}/admin/actions/variables/1/delete || true
forgejo-curl.sh web --form name=TEST_SCHEDULE_RUNSON --form data=docker http://${HOST_PORT}/admin/actions/variables/new
#
# 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-post-7-0-schedule/branches
verify_ref
# 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/post-7-0-schedule-volume/DONE; then
cat $FORGEJO_RUNNER_LOGS
false
fi
c=/srv/example/post-7-0-schedule/contexts/schedule/github
cat $c
test "schedule" = "$(jq -r .event_name <$c)"
test "schedule" = "$(jq -r .event.action <$c)"