Skip to content

Supabase Heartbeat

Supabase Heartbeat #2

name: Supabase Heartbeat
# Keeps the Fuchitron Supabase project alive on the free tier.
# Supabase pauses projects after 7 days with no traffic, which
# broke the spectate feature on 2026-07-23. This workflow pings
# the matches table every 3 days so the project is always warm.
#
# Setup:
# 1. Add a repository secret named SUPABASE_ANON_KEY with the
# publishable/anon key (the same one used in src/app.js and
# src/live.html — it's a public-by-design key restricted by RLS).
# 2. The cron runs at 10:00 UTC every 3 days.
# 3. You can also trigger it manually from the Actions tab.
on:
schedule:
- cron: '0 10 */3 * *'
workflow_dispatch:
jobs:
ping:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Ping Fuchitron Supabase
run: |
if [ -z "${{ secrets.SUPABASE_ANON_KEY }}" ]; then
echo "::error::SUPABASE_ANON_KEY secret is not set"
exit 1
fi
response=$(curl -sS -w "\n%{http_code}" \
-H "apikey: ${{ secrets.SUPABASE_ANON_KEY }}" \
-H "Authorization: Bearer ${{ secrets.SUPABASE_ANON_KEY }}" \
"https://jorehxhrnpggvsgdnrpk.supabase.co/rest/v1/matches?select=match_code&limit=1")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "HTTP $http_code"
echo "Body: $body"
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
echo "✅ Supabase is alive"
else
echo "::error::Unexpected status from Supabase: $http_code"
exit 1
fi