implement waiting based on a file

This commit is contained in:
Kwonunn 2024-10-13 12:45:19 +02:00
parent 631055d190
commit c3eb8918b4
2 changed files with 15 additions and 3 deletions

View file

@ -4,5 +4,11 @@ on:
jobs: jobs:
test: test:
runs-on: docker runs-on: docker
container:
image: code.forgejo.org/oci/debian:bookworm
options: "--volume /srv/example:/srv/example"
steps: steps:
- run: sleep 15 - run: |
while ! [ -f /srv/example/schedule-noncancel/PUSHED ]; do
sleep 3
done

View file

@ -3,7 +3,9 @@ repo=root/example-$example
# delete the repository # delete the repository
# #
api=$url/api/v1 api=$url/api/v1
forgejo-curl.sh api_json -X DELETE $api/repos/root/example-$example if forgejo-curl.sh api_json -X GET $api/repos/root/example-$example; then
forgejo-curl.sh api_json -X DELETE $api/repos/root/example-$example
fi
# #
# push the repository # push the repository
@ -61,6 +63,10 @@ echo Push to repo again
# #
forgejo-test-helper.sh push_workflow actions/example-echo $url root example-$example setup-forgejo $token forgejo-test-helper.sh push_workflow actions/example-echo $url root example-$example setup-forgejo $token
echo Signal to the workflow that the push has happened
mkdir -p /srv/example/schedule-noncancel
touch /srv/example/schedule-noncancel/PUSHED
# #
# Wait for the workflow to finish anyway # Wait for the workflow to finish anyway
# #
@ -71,7 +77,7 @@ checkFinished() {
"select status \ "select status \
from action_run \ from action_run \
where id = $run_id \ where id = $run_id \
and status != 6" and (status != 6 and status != 5)"
} }
finished_status=$(checkFinished) finished_status=$(checkFinished)