Check S3 Backup and Notify Slack #28
This file contains 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: 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 }} |