Skip to content

Ping Supabase to Prevent Pausing #67

Ping Supabase to Prevent Pausing

Ping Supabase to Prevent Pausing #67

Workflow file for this run

name: Ping Supabase to Prevent Pausing
on:
schedule:
- cron: '0 0 * * *' # Runs at 12:00 AM UTC every day
workflow_dispatch: # Allows manual triggering from the GitHub UI
jobs:
ping:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # Use Node.js 18
# Step 3: Install Supabase Client
- name: Install Supabase Client
run: npm install @supabase/supabase-js --force
# Step 4: Ping Supabase
- name: Ping Supabase
env:
SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} # Supabase project URL
SUPABASE_KEY: ${{ secrets.NEXT_SERVICE_ROLE_KEY }} # Supabase service role key
run: |
node -e "
(async () => {
try {
// Debugging: Log environment variables (optional)
console.log('Supabase URL:', process.env.SUPABASE_URL);
console.log('Supabase Key:', process.env.SUPABASE_KEY);
// Import Supabase client
const { createClient } = require('@supabase/supabase-js');
const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_KEY);
// Ping Supabase by querying a table (e.g., 'songs')
const { data, error } = await supabase.from('record').select('*').limit(10);
// Handle errors
if (error) throw error;
// Log success
console.log('Ping successful:', data);
} catch (err) {
// Log and exit with error
console.error('Error pinging Supabase:', err.message);
process.exit(1);
}
})();
"