spawn/.github/workflows/improve.yml
B 6b5a547e2d fix: Treat 429 (cycle already running) as success in workflows
When MAX_CONCURRENT=1 and a cycle is in progress, the trigger server
returns 429. This is expected behavior, not an error — the previous
curl -f treated it as failure (exit code 22).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-10 03:43:32 +00:00

34 lines
998 B
YAML

name: Trigger Discovery
on:
schedule:
- cron: '*/30 * * * *'
issues:
types: [opened, reopened]
workflow_dispatch:
concurrency:
group: discovery-sprite-trigger
cancel-in-progress: false
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger discovery sprite
env:
SPRITE_URL: ${{ secrets.DISCOVERY_SPRITE_URL }}
TRIGGER_SECRET: ${{ secrets.DISCOVERY_TRIGGER_SECRET }}
run: |
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