Ping Supabase to Prevent Pausing #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ping Supabase to Prevent Pausing | |
| on: | |
| schedule: | |
| - cron: '0 15 * * 1' # Monday at 12:00 BRT | |
| - cron: '0 15 * * 4' # Thursday at 12:00 BRT | |
| 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: Query PungDummy table | |
| - name: Query PungDummy Table | |
| 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 { | |
| const { createClient } = require('@supabase/supabase-js'); | |
| const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_KEY); | |
| const { data, error } = await supabase | |
| .from('PingDummy') | |
| .select('*') | |
| .limit(1); | |
| if (error) throw error; | |
| console.log('Query successful:', data); | |
| } catch (err) { | |
| console.error('Error querying Supabase:', err.message); | |
| process.exit(1); | |
| } | |
| })(); | |
| " |