Skip to content

Forward Test Cron

Forward Test Cron #581

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 — for trade alerts
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
uses: actions/setup-node@v4
with:
node-version: "20"
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 }}
run: npm run cron-tick