caelum0x a8e8648a9b feat: composite action that keeps a free Supabase project from pausing
REST root ping + cheap table/rpc query with the anon key, retries with
backoff, job summary, early warnings (stale last success, weekly cron,
GitHub 60-day schedule disable), copy-paste workflow examples and a
curl-only fallback. Self-test workflow runs against a real endpoint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-12 07:54:48 +03:00

26 lines
932 B
YAML

# No action, no dependencies: one curl call. You lose retries, the job summary and the
# early warnings, but it is the smallest thing that works.
name: Keep Supabase alive (curl only)
on:
schedule:
- cron: "29 8 * * *"
workflow_dispatch:
jobs:
ping:
runs-on: ubuntu-latest
steps:
- name: Read one row through the REST API
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
run: |
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 20 \
-H "apikey: $SUPABASE_ANON_KEY" \
-H "Authorization: Bearer $SUPABASE_ANON_KEY" \
"$SUPABASE_URL/rest/v1/keepalive?select=*&limit=1")
echo "HTTP $code"
if [ "$code" = "540" ]; then echo "::error::project is paused; restore it in the dashboard"; exit 1; fi
case "$code" in 2*) exit 0 ;; *) exit 1 ;; esac