From 42160f2925daa3c0d4ef2b95f68a87858972e6a3 Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Tue, 13 Oct 2026 10:07:31 -0500 Subject: [PATCH] fix(ci): retry Cursor webhook HTTP 400s on main (#19077) --- .github/workflows/cursor-hygiene-webhook.yml | 26 +++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cursor-hygiene-webhook.yml b/.github/workflows/cursor-hygiene-webhook.yml index ea0f579b4ac6d59a934868771c5fe2b4aa1c2f25..8f8dde38a5fe6295b5f55cb7b7917e08686c054b 100644 --- a/.github/workflows/cursor-hygiene-webhook.yml +++ b/.github/workflows/cursor-hygiene-webhook.yml @@ -28,9 +28,23 @@ jobs: echo "Missing CURSOR_T3CODE_WEBHOOK_URL or CURSOR_T3CODE_WEBHOOK_AUTH — skipping." exit 0 fi - curl -fsS --max-time 60 -X POST "$URL" \ - -H "Authorization: $AUTH" \ - -H "Content-Type: application/json" \ - -H "X-GitHub-Event: ${{ github.event_name }}" \ - -H "X-GitHub-Delivery: ${{ github.run_id }}-${{ github.run_attempt }}" \ - --data-binary @"${{ github.event_path }}" + for attempt in 1 2 3; do + curl_status=0 + http_status=$(curl -fsS --max-time 60 -X POST "$URL" \ + --output /dev/null --write-out '%{http_code}' \ + -H "Authorization: $AUTH" \ + -H "Content-Type: application/json" \ + -H "X-GitHub-Event: ${{ github.event_name }}" \ + -H "X-GitHub-Delivery: ${{ github.run_id }}-${{ github.run_attempt }}" \ + --data-binary @"${{ github.event_path }}") || curl_status=$? + if [ "$curl_status" -eq 0 ]; then + exit 0 + fi + if [ "$GITHUB_REF" != "refs/heads/main" ] || \ + [ "$curl_status" -ne 22 ] || [ "$http_status" != "400" ] || \ + [ "$attempt" -eq 3 ]; then + exit "$curl_status" + fi + echo "Cursor webhook returned HTTP 400; retrying in 5 seconds ($attempt/2)." + sleep 5 + done -- 2.54.0