mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 22:05:24 +02:00
feat: schedule 6h backup via GitHub Actions instead of Vercel cron
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
name: Supabase Backup to Dropbox
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0,6,12,18 * * *' # every 6h at 00:00, 06:00, 12:00, 18:00 UTC
|
||||
workflow_dispatch: # allow manual trigger from GitHub UI
|
||||
|
||||
jobs:
|
||||
backup:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Trigger backup endpoint
|
||||
run: |
|
||||
RESPONSE=$(curl -s -w "\n%{http_code}" \
|
||||
-X GET \
|
||||
-H "Authorization: Bearer ${{ secrets.BACKUP_SECRET }}" \
|
||||
https://craze-data-check.vercel.app/api/backup)
|
||||
|
||||
HTTP_STATUS=$(echo "$RESPONSE" | tail -n1)
|
||||
BODY=$(echo "$RESPONSE" | head -n-1)
|
||||
|
||||
echo "Status: $HTTP_STATUS"
|
||||
echo "Response: $BODY"
|
||||
|
||||
if [ "$HTTP_STATUS" != "200" ]; then
|
||||
echo "Backup failed with status $HTTP_STATUS"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user