Skip to content

Supabase Keepalive

Supabase Keepalive #10

Workflow file for this run

name: Supabase Keepalive
# Jaga project Supabase free tier agar tidak di-pause otomatis karena idle 7 hari.
# Mengirim query REST API berkala untuk mereset timer idle Supabase.
on:
schedule:
- cron: '15 */6 * * *' # Berjalan setiap 6 jam (00:15, 06:15, 12:15, 18:15 UTC)
workflow_dispatch: {} # Dapat ditrigger manual via tab Actions
permissions:
contents: read
jobs:
ping:
runs-on: ubuntu-latest
steps:
- name: Ping Supabase Database
env:
DEFAULT_URL: ${{ secrets.SUPABASE_URL }}
DEFAULT_KEY: ${{ secrets.SUPABASE_KEY }}
PROJECTS: ${{ secrets.SUPABASE_PROJECTS }}
run: |
if [ -n "$PROJECTS" ]; then
echo "Menggunakan konfigurasi secrets.SUPABASE_PROJECTS..."
echo "$PROJECTS" | jq -c '.[]' | while read -r p; do
url=$(echo "$p" | jq -r '.url')
key=$(echo "$p" | jq -r '.key')
echo "-> Ping $url"
code=$(curl -sS -o /dev/null -w "%{http_code}" \
-H "apikey: $key" \
-H "Authorization: Bearer $key" \
"$url/rest/v1/transaksi?select=id&limit=1")
echo " HTTP Status: $code"
done
else
echo "Menggunakan default target project RM. Ciremai..."
echo "-> Ping $DEFAULT_URL"
code=$(curl -sS -o /dev/null -w "%{http_code}" \
-H "apikey: $DEFAULT_KEY" \
-H "Authorization: Bearer $DEFAULT_KEY" \
"$DEFAULT_URL/rest/v1/transaksi?select=id&limit=1")
echo " HTTP Status: $code"
if [ "$code" -ne 200 ]; then
echo "⚠️ Peringatan: Status code $code"
else
echo "✅ Supabase aktif dan berhasil di-ping!"
fi
fi