-
Notifications
You must be signed in to change notification settings - Fork 2
42 lines (35 loc) · 1.21 KB
/
Synchronize_Sheet_and_DB.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
36
37
38
39
40
41
42
name: Synchronize Google Sheet and Database
on:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight
workflow_dispatch: # Allows manual triggering
concurrency:
group: database-update
jobs:
sync_data:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Python Dependencies
run: |
pip install pandas gspread oauth2client
- name: Synchronize Google Sheet and Database
env:
SHEET_ID: ${{ secrets.SHEET_ID }}
GOOGLE_API_KEYS: ${{ secrets.GOOGLE_API_KEYS }}
run: |
python 'src/scripts/synchronize_google_sheet_and_db.py'
- name: Commit and Push Database Files
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add 'data/Full_Database_Backend.db' 'data/Full_Database_Backend.json'
git commit -m "Synchronized database with Google Sheet" -a || echo "No changes to commit."
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}