| ... | ... | @@ -28,9 +28,23 @@ jobs: |
| 28 | 28 | echo "Missing CURSOR_T3CODE_WEBHOOK_URL or CURSOR_T3CODE_WEBHOOK_AUTH — skipping." |
| 29 | 29 | exit 0 |
| 30 | 30 | fi |
| 31 | | curl -fsS --max-time 60 -X POST "$URL" \ |
| 32 | | -H "Authorization: $AUTH" \ |
| 33 | | -H "Content-Type: application/json" \ |
| 34 | | -H "X-GitHub-Event: ${{ github.event_name }}" \ |
| 35 | | -H "X-GitHub-Delivery: ${{ github.run_id }}-${{ github.run_attempt }}" \ |
| 36 | | --data-binary @"${{ github.event_path }}" |
| 31 | for attempt in 1 2 3; do |
| 32 | curl_status=0 |
| 33 | http_status=$(curl -fsS --max-time 60 -X POST "$URL" \ |
| 34 | --output /dev/null --write-out '%{http_code}' \ |
| 35 | -H "Authorization: $AUTH" \ |
| 36 | -H "Content-Type: application/json" \ |
| 37 | -H "X-GitHub-Event: ${{ github.event_name }}" \ |
| 38 | -H "X-GitHub-Delivery: ${{ github.run_id }}-${{ github.run_attempt }}" \ |
| 39 | --data-binary @"${{ github.event_path }}") || curl_status=$? |
| 40 | if [ "$curl_status" -eq 0 ]; then |
| 41 | exit 0 |
| 42 | fi |
| 43 | if [ "$GITHUB_REF" != "refs/heads/main" ] || \ |
| 44 | [ "$curl_status" -ne 22 ] || [ "$http_status" != "400" ] || \ |
| 45 | [ "$attempt" -eq 3 ]; then |
| 46 | exit "$curl_status" |
| 47 | fi |
| 48 | echo "Cursor webhook returned HTTP 400; retrying in 5 seconds ($attempt/2)." |
| 49 | sleep 5 |
| 50 | done |