-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.85 KB
/
main.yml
File metadata and controls
58 lines (48 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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);
}
})();
"