indexer-cron #465
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: indexer-cron | |
| # Scheduled trigger for the Molotov indexer. This is the ACTIVE scheduler while the | |
| # Vercel project is on the Hobby plan. Do NOT add a sub-daily `crons` entry to | |
| # apps/web/vercel.json while on Hobby: Vercel rejects it and FAILS THE WHOLE DEPLOY | |
| # ("Hobby accounts are limited to daily cron jobs") — it is a hard deploy blocker, not | |
| # a silent no-op, and production stays stuck on the previous commit. | |
| # | |
| # Note that */5 below is a request, not a guarantee: GitHub throttles scheduled events | |
| # and in practice runs here land 2-3 h apart. MAX_LEDGER_LAG is calibrated to that | |
| # real spacing. When the project moves to Vercel Pro, switch to a vercel.json cron | |
| # (which gets a real schedule) and disable this workflow. | |
| # See doc/indexer-operations.md. | |
| # | |
| # Required repo secrets: | |
| # INDEXER_URL — deployed app base URL (e.g. https://<app>.vercel.app) | |
| # CRON_SECRET — same value set as the CRON_SECRET env var on the deployment | |
| on: | |
| schedule: | |
| - cron: '*/5 * * * *' | |
| workflow_dispatch: {} | |
| # Never run two polls at once (a slow poll must not overlap the next tick). | |
| concurrency: | |
| group: indexer-cron | |
| cancel-in-progress: false | |
| jobs: | |
| poll: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Trigger indexer poll | |
| run: | | |
| if [ -z "${{ secrets.INDEXER_URL }}" ] || [ -z "${{ secrets.CRON_SECRET }}" ]; then | |
| echo "::error::INDEXER_URL and CRON_SECRET repo secrets must be set." | |
| exit 1 | |
| fi | |
| code=$(curl -sS -m 60 -o /tmp/out -w '%{http_code}' \ | |
| -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ | |
| "${{ secrets.INDEXER_URL }}/api/indexer") | |
| echo "HTTP $code" | |
| cat /tmp/out | |
| echo | |
| test "$code" = "200" |