Recommendations (.github/workflows/recs.yml)

Runs nightly at 04:15 UTC, plus workflow_dispatch. concurrency: recs means an overlapping run queues behind the current one. Three scripts run in order against the service-role Supabase client:
1

pnpm recs:stats — scripts/build-channel-stats.ts

Rolls up reactions, saves, and a 7-day watch-history window into channel_stats, including trending_score (watches_7d + 3×likes_7d + 5×hearts_7d, computed over the same 7-day window as the watch count so a channel’s long-dead popularity can’t keep it “trending” forever).
2

pnpm recs:similar — scripts/build-channel-similar.ts

Ranks each channel’s top 40 peers over the published native catalogue slice (src/recs/similar.ts, with the ranking the device runs) into channel_similar, and prunes rows left over from a prior build. A channel public.channels lacks gets no rows, and the device ranks for it. A missing or stale slice fails the step before anything is written.
3

pnpm recs:users — scripts/build-user-recs.ts

Builds every signed-in viewer’s user_recs rows (Top picks, Because you liked/saved …, trending-by-language), one Jev call per viewer when TYPESAFE_API_KEY is set. See Recommendations for what happens when it isn’t.

Secrets

RECS_DRY_RUN

Triggering the workflow manually with its dry_run input sets RECS_DRY_RUN=1, which computes everything and logs what each script would have written without touching any table — a way to verify a change on a branch before it can affect production data.
Cost, if TYPESAFE_API_KEY is set: roughly 10k input tokens per user at $0.042/Mtok, about **$0.0004 per user per night**. A 1,000-user nightly run costs under half a cent.

Catalog slices (.github/workflows/catalog-slices.yml)

Scheduled every 3 hours, plus workflow_dispatch. GitHub starts the scheduled runs 2 to 13 hours apart, a median of 6.6. Builds the per-platform catalog slices and publishes them to the catalog bucket in Supabase Storage; see Catalog pipeline. Read-only checkout, no deploy. Its failures, states and alerts are written down in the catalog pipeline contract.

Refresh EPG (.github/workflows/epg.yml)

Runs every 6 hours, plus workflow_dispatch. Covered in full in Catalog pipeline — the short version is a credential-free grab job (checks out the third-party iptv-org/epg grabber, pinned to a fixed commit) feeding a separate publish job that holds the Supabase service role and never touches that third-party code. It publishes the guide to Supabase Storage; it does not commit or deploy.

Alerts

Two layers, on two schedulers, so one dying does not silence the other.
  • .github/workflows/alerts.yml runs on workflow_run for every finished run of Catalog slices, Refresh EPG and Recommendations. Its script, scripts/alert-on-change.mjs, reads the run’s first error line and the job’s earlier runs through the GitHub API and sends a Telegram message only when something changed: the first failure, a new reason, once a day while a job stays red, and “back to normal” on the first green run. The message names the job, the reason and the run link. Every other run writes one line in the Alerts log saying why it sent nothing. It catches a run that happened and went wrong.
  • api/watchdog.ts runs as a Vercel cron (vercel.json, daily 14:00 UTC), HEADs catalog/web.json, catalog/native.json and guide/epg.json in Supabase Storage and reads Last-Modified. A catalog slice older than 16 hours (GitHub starts the three-hourly runs up to 13 hours apart), the guide older than 13 hours, or any object missing goes to Telegram. Every check logs one JSON line per object and one saying whether Telegram was sent. It catches a run that never happened, which no workflow can report about itself.
Both need TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID: as repository secrets for the workflow, as Vercel env for the cron, which also needs CRON_SECRET (Vercel sends it as a bearer token; the function answers 401 to anything else). scripts/telegram-chat-id.sh prints the chat id once the bot has seen a message. With the Telegram vars unset, the workflow step exits green and the watchdog still returns its report and logs its checks; nothing is sent.
The watchdog runs in the Vercel production deploy, which is pinned to the 2026-09-30 rollback. Its 16-hour limit, its log lines and its Sentry wrapper reach production only when Jake promotes a deploy that contains them; until then production checks at 7 hours and logs nothing. See the catalog pipeline contract.