From ee6c695d33c796c782a94e567b84826ba376d9de Mon Sep 17 00:00:00 2001 From: Firq Date: Tue, 22 Oct 2024 18:26:49 +0200 Subject: [PATCH] modified wait --- .forgejo/workflows/unlighthouse.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/unlighthouse.yml b/.forgejo/workflows/unlighthouse.yml index dffa25b..4ede91d 100644 --- a/.forgejo/workflows/unlighthouse.yml +++ b/.forgejo/workflows/unlighthouse.yml @@ -22,14 +22,21 @@ jobs: - name: Wait for service to be healthy run: | for i in {1..10}; do - STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:26400/) + echo "Checking website availability (Attempt $i)..."; + STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:26400/) || true; if [ "$STATUS" -eq 200 ]; then - echo "Website is up with status 200!" - break + echo "Website is up with status 200!"; + break; + elif [ "$STATUS" -eq 000 ]; then + echo "Could not connect to website. Curl returned status: $STATUS"; else - echo "Website not ready yet, status: $STATUS" + echo "Website not ready yet, status: $STATUS"; fi - sleep 5 + if [ "$i" -eq 10 ]; then + echo "Website did not become ready in time. Exiting..."; + exit 1; + fi + sleep 5; done - name: Checkout repository uses: https://code.forgejo.org/actions/checkout@v3