Forward Test Cron #671
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: Forward Test Cron | |
| # Runs the cron tick logic directly on the GitHub-hosted runner instead of | |
| # calling a Vercel route. Binance API blocks AWS IP ranges (HTTP 451), so all | |
| # Vercel regions fail. GitHub runners run on Azure with currently-allowed IPs. | |
| # | |
| # Required GitHub secrets: | |
| # NEXT_PUBLIC_SUPABASE_URL — Supabase project URL | |
| # SUPABASE_SERVICE_ROLE_KEY — Supabase service-role key (server-side write) | |
| # Optional secrets: | |
| # TELEGRAM_BOT_TOKEN — for trade alerts | |
| # TELEGRAM_CHAT_ID — private monitoring chat (V5 + V6.2, English) | |
| # TELEGRAM_PUBLIC_CHAT_ID — public member channel @ArikanTrade (V5 only, Turkish) | |
| on: | |
| schedule: | |
| # Run 4 times per hour (every 15 min, offset by 2) to compensate for | |
| # GitHub Actions scheduled-workflow latency. Candles close hourly at :00, | |
| # so the :02 / :17 / :32 / :47 runs all process the same closed candle. | |
| # Cron-tick is idempotent: ticks with no new candles exit in ~1.5s as a | |
| # no-op. Free-tier compute use stays well under quota (public repo). | |
| - cron: "2,17,32,47 * * * *" | |
| workflow_dispatch: | |
| jobs: | |
| tick: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| # Node 22+ — @supabase/realtime-js (pulled by supabase-js) now requires | |
| # native WebSocket support, which only exists from Node 22 onward. | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - name: Install dependencies | |
| # Use `npm install` instead of `npm ci` because the lockfile was | |
| # generated on Windows and is missing Linux-specific native deps | |
| # (e.g. @emnapi/runtime). `npm install` resolves them on the runner. | |
| run: npm install --no-audit --no-fund --no-save | |
| - name: Run cron tick | |
| env: | |
| NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} | |
| SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} | |
| TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| TELEGRAM_PUBLIC_CHAT_ID: ${{ secrets.TELEGRAM_PUBLIC_CHAT_ID }} | |
| run: npm run cron-tick |