diff --git a/.github/workflows/improve.yml b/.github/workflows/improve.yml index 3e5f2ad6..4ae4fde4 100644 --- a/.github/workflows/improve.yml +++ b/.github/workflows/improve.yml @@ -20,5 +20,15 @@ jobs: SPRITE_URL: ${{ secrets.DISCOVERY_SPRITE_URL }} TRIGGER_SECRET: ${{ secrets.DISCOVERY_TRIGGER_SECRET }} run: | - curl -sf -X POST "${SPRITE_URL}/trigger?reason=${{ github.event_name }}" \ - -H "Authorization: Bearer ${TRIGGER_SECRET}" + HTTP_CODE=$(curl -s -o /tmp/response.json -w '%{http_code}' -X POST \ + "${SPRITE_URL}/trigger?reason=${{ github.event_name }}" \ + -H "Authorization: Bearer ${TRIGGER_SECRET}") + cat /tmp/response.json + if [ "$HTTP_CODE" = "429" ]; then + echo "Cycle already running, skipping" + elif [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + echo "Triggered successfully" + else + echo "Failed with HTTP $HTTP_CODE" + exit 1 + fi diff --git a/.github/workflows/refactor.yml b/.github/workflows/refactor.yml index 396a45b7..8f1f7ca1 100644 --- a/.github/workflows/refactor.yml +++ b/.github/workflows/refactor.yml @@ -20,5 +20,15 @@ jobs: SPRITE_URL: ${{ secrets.REFACTOR_SPRITE_URL }} TRIGGER_SECRET: ${{ secrets.REFACTOR_TRIGGER_SECRET }} run: | - curl -sf -X POST "${SPRITE_URL}/trigger?reason=${{ github.event_name }}&issue=${{ github.event.issue.number || '' }}" \ - -H "Authorization: Bearer ${TRIGGER_SECRET}" + HTTP_CODE=$(curl -s -o /tmp/response.json -w '%{http_code}' -X POST \ + "${SPRITE_URL}/trigger?reason=${{ github.event_name }}&issue=${{ github.event.issue.number || '' }}" \ + -H "Authorization: Bearer ${TRIGGER_SECRET}") + cat /tmp/response.json + if [ "$HTTP_CODE" = "429" ]; then + echo "Cycle already running, skipping" + elif [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + echo "Triggered successfully" + else + echo "Failed with HTTP $HTTP_CODE" + exit 1 + fi