mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-10 20:39:59 +00:00
- discovery: every 30 min → every 3 days - refactor: every 5 min → hourly - security: every 5 min → every 30 min Co-authored-by: Security Reviewer <security-reviewer@spawn.dev> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51 lines
1.8 KiB
YAML
51 lines
1.8 KiB
YAML
name: Trigger Discovery
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 */3 * *'
|
|
issues:
|
|
types: [opened, reopened, labeled]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: discovery-sprite-trigger
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
trigger:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
# Only trigger on issues with safe-to-work AND (cloud-request or agent-request) labels, or schedule/manual
|
|
if: >-
|
|
github.event_name != 'issues' ||
|
|
(contains(github.event.issue.labels.*.name, 'safe-to-work') &&
|
|
(contains(github.event.issue.labels.*.name, 'cloud-request') ||
|
|
contains(github.event.issue.labels.*.name, 'agent-request')))
|
|
steps:
|
|
- name: Trigger and stream discovery cycle
|
|
env:
|
|
SPRITE_URL: ${{ secrets.DISCOVERY_SPRITE_URL }}
|
|
TRIGGER_SECRET: ${{ secrets.DISCOVERY_TRIGGER_SECRET }}
|
|
run: |
|
|
set +e
|
|
# --fail-with-body: exit 22 on HTTP errors but still print the body
|
|
# -N: no output buffering (stream chunks in real-time)
|
|
# --max-time: hard cap matching the Sprite's cycle timeout + grace
|
|
curl -sSN --http1.1 --fail-with-body --max-time 5400 -X POST \
|
|
"${SPRITE_URL}/trigger?reason=${{ github.event_name }}&issue=${{ github.event.issue.number || '' }}" \
|
|
-H "Authorization: Bearer ${TRIGGER_SECRET}"
|
|
CURL_EXIT=$?
|
|
set -e
|
|
|
|
if [ "$CURL_EXIT" -eq 0 ]; then
|
|
echo ""
|
|
echo "=== Cycle completed ==="
|
|
elif [ "$CURL_EXIT" -eq 22 ]; then
|
|
# HTTP error — body was already printed above (429 = already running, etc.)
|
|
echo ""
|
|
echo "=== Trigger returned HTTP error (see output above) ==="
|
|
else
|
|
echo ""
|
|
echo "=== curl failed (exit=$CURL_EXIT) ==="
|
|
exit 1
|
|
fi
|