diff --git a/.github/workflows/mark-stable.yml b/.github/workflows/mark-stable.yml index 07ed882..b4428a6 100644 --- a/.github/workflows/mark-stable.yml +++ b/.github/workflows/mark-stable.yml @@ -25,12 +25,14 @@ jobs: SHA="${GITHUB_SHA}" API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows/ci.yml/runs?head_sha=${SHA}&event=push&per_page=20" + WAIT_INTERVAL_SECONDS=20 + MAX_ATTEMPTS=360 # 2 hours max wait STATUS="" CONCLUSION="" - echo "Waiting for CI on main for ${SHA}..." - for attempt in $(seq 1 30); do + echo "Waiting for CI on main for ${SHA} (up to 2 hours)..." + for attempt in $(seq 1 "${MAX_ATTEMPTS}"); do RESPONSE="$(curl -fsSL \ -H "Authorization: Bearer ${GH_TOKEN}" \ -H "Accept: application/vnd.github+json" \ @@ -40,9 +42,9 @@ jobs: CONCLUSION="$(printf '%s' "${RESPONSE}" | jq -r '.workflow_runs[] | select(.head_branch=="main") | .conclusion' | head -n1)" if [[ -n "${STATUS}" ]]; then - echo "CI status=${STATUS} conclusion=${CONCLUSION:-none} (attempt ${attempt}/30)" + echo "CI status=${STATUS} conclusion=${CONCLUSION:-none} (attempt ${attempt}/${MAX_ATTEMPTS})" else - echo "No CI run for main found yet (attempt ${attempt}/30)" + echo "No CI run for main found yet (attempt ${attempt}/${MAX_ATTEMPTS})" fi if [[ "${STATUS}" == "completed" ]]; then @@ -54,7 +56,7 @@ jobs: exit 1 fi - sleep 20 + sleep "${WAIT_INTERVAL_SECONDS}" done if [[ "${STATUS}" != "completed" || "${CONCLUSION}" != "success" ]]; then