diff --git a/.github/workflows/deploy_check.yml b/.github/workflows/deploy_check.yml index 24664159553a..7fda2b1a446c 100644 --- a/.github/workflows/deploy_check.yml +++ b/.github/workflows/deploy_check.yml @@ -20,15 +20,23 @@ jobs: max_attempts=10 attempt=1 status_code=0 + echo "Waiting for review app to be deployed/redeployed, trying in 10 minutes..." + sleep 600 while [ $attempt -le $max_attempts ]; do - response=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api) - status_code=$(echo "$response" | jq -r 'if .version and .timestamp and .queue_services and .data_services then 200 else 400 end') - if [ $status_code -eq 200 ]; then - echo "Deployment successful" - exit 0 + response=$(curl -s -o /dev/null -w "%{http_code}" https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api) + status_code=$(echo $response | head -n 1) + if [ $status_code -eq 200 ]; then + body=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api) + if echo "$body" | jq -e '.version and .timestamp and .queue_services == "ok" and .data_services == "ok"' > /dev/null; then + echo "Deployment successful" + exit 0 + else + echo "Deployment status unknown, retrying in 3 minutes..." + sleep 180 + fi else - echo "Deployment status unknown, retrying in 3 minutes..." - sleep 180 + echo "Waiting for review app to be ready, retrying in 3 minutes..." + sleep 180 attempt=$((attempt + 1)) fi done