-
Notifications
You must be signed in to change notification settings - Fork 12
35 lines (29 loc) · 1.02 KB
/
check_backup.yml
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
name: Check S3 Backup and Notify Slack
on:
workflow_dispatch: # Allows manual trigger from GitHub Actions UI
schedule:
- cron: '0 13 * * *' # 5:00 AM PST (UTC-8)
jobs:
check-backup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install boto3 (AWS SDK for Python)
run: |
python -m pip install --upgrade pip
pip install boto3 requests
- name: Check if backup exists in S3
run: python .github/scripts/check_backup.py
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
BACKUP_BUCKET_NAME: "${{ secrets.BACKUP_BUCKET_NAME }}"
S3_FOLDER: "db_backup/"
SLACK_CHANNEL: "#cd2h"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}