If you want to keep your Supabase account active and prevent automatic suspension due to inactivity, you can set up a GitHub Actions cron job to ping your database at regular intervals. This tutorial will guide you through the process in simple steps.
Steps to Create a GitHub Actions Cron Job
1️⃣ Create a New GitHub Repository (If Not Already Done)
Go to GitHub and create a new repository.
Clone the repository to your local system or work directly on GitHub.
2️⃣ Navigate to the .github/workflows Directory
In your repository, create a new folder named .github/workflows.
Inside this folder, create a new file, e.g., prevent-supabase-inactivity.yaml.
3️⃣ Write the GitHub Actions Workflow YAML File
Copy and paste the following YAML code into the file:
yaml
Copy
Edit
name: Prevent Supabase Inactivity
on:
schedule:
- cron: '0 0 * * 0' # Runs at midnight every Sunday
workflow_dispatch: # Allows manual triggering
jobs:
ping-database:
runs-on: ubuntu-latest
steps:
- name: Make an API request to Supabase
run: |
curl -X GET "https://your-supabase-url.com/rest/v1/" \
-H "apikey: YOUR_SUPABASE_API_KEY" \
-H "Authorization: Bearer YOUR_SUPABASE_API_KEY"
4️⃣ Replace the Placeholders with Your Supabase Details
your-supabase-url.com → Replace with your Supabase project URL.
YOUR_SUPABASE_API_KEY → Replace with your Supabase API key.
5️⃣ Commit and Push the Workflow to GitHub
Save the file and commit the changes:
6️⃣ Enable GitHub Actions in Your Repository
Go to your GitHub repository → Click on Actions.
Find the newly added workflow and ensure it's enabled.
7️⃣ Verify That the Workflow Runs Automatically
Your cron job will now run every Sunday at midnight (UTC).
You can manually trigger the workflow from the GitHub Actions tab.
Final Thoughts
This simple automation helps prevent your Supabase account from being marked inactive by periodically sending a request to your database. If needed, you can modify the cron schedule based on your preferences.
Happy Coding...
Top comments (0)