Health Monitoring Configuration via GitHub Actions to Avoid Automatic Pausing of Supabase Free Plan
In the Supabase Free Plan, projects are automatically paused if no activity is detected for 7 consecutive days, hindering development continuity and prototype operations. Manual resumption from the dashboard results in API downtime. This infrastructure configuration resets the inactivity timer by sending a REST API request every 5 days using GitHub Actions scheduled execution.
Configuration Architecture and Security Requirements
This automation stack operates within a private repository to protect API keys. GitHub Actions Free Tier provides 2,000 minutes of execution time per month, sufficient for lightweight curl operations.
1. Credential Management via GitHub Secrets
Register environment variables in Settings > Secrets and variables > Actions. Enter raw strings without quotes.
SUPABASE_URL_1: Project REST endpoint (e.g., https://[PROJECT_ID].supabase.co)
SUPABASE_KEY_1: anon (anonymous) public API key
⚠️ Security Note: Use the anon key for authentication. The service_role key possesses permissions to bypass Row Level Security (RLS), creating unnecessary security risks for health monitoring.
Workflow Implementation
The configuration for .github/workflows/keepalive.yml includes workflow_dispatch for manual testing.
name: Supabase Keep Alive
on:
schedule:
- cron: '0 0 */5 * *' # Runs at midnight every 5 days
workflow_dispatch: # Allow manual execution
jobs:
keepalive:
runs-on: ubuntu-latest
steps:
- name: Ping Supabase Project
run: |
curl -s "${{ secrets.SUPABASE_URL_1 }}/rest/v1/" \
-H "apikey: ${{ secrets.SUPABASE_KEY_1 }}" \
-H "Authorization: Bearer ${{ secrets.SUPABASE_KEY_1 }}"
Cron Syntax Analysis and Execution Interval Optimization
The execution interval is set to 5 days (*/5) to provide a margin against the 7-day threshold. POSIX standard cron syntax controls the timing.
0 0 */5 * *: Executes at 00:00 every 5 days. Actual execution may be delayed by GitHub Actions runner load, which is acceptable for this use case.
Troubleshooting
401 Unauthorized: Occurs if SUPABASE_KEY_1 is incorrect or the apikey header is missing. Verify Secret values for trailing spaces or line breaks.
404 Not Found: Ensure /rest/v1/ is appended to SUPABASE_URL_1. Inaccurate endpoints may fail to trigger activity counts.
Workflow not triggering: Scheduled workflows may be disabled if the repository has no commits for an extended period. Re-enable the workflow manually or configure periodic dummy commits.
Operational Verification Logs
The protocol log indicates successful request completion. HTTP status 200 OK or a JSON response containing schema information confirms activity registration.
Run curl -s "***" -H "apikey: ***" -H "Authorization: Bearer ***"
{
"swagger": "2.0",
"info": {
"title": "PostgREST API",
"description": "Standard REST interface for any PostgreSQL database"
},
"host": "your-project.supabase.co",
"basePath": "/",
"schemes": ["https"]
}
Process completed with exit code 0
Operational Notes
This method assists operation within Free Plan limits. For production environments or mission-critical services, upgrading to the Pro Plan is recommended to disable automatic pausing. Periodically monitor execution logs and track changes in API key expiration or endpoints.