Repository navigation
56 lines (46 loc) · 1.71 KB
/
Copy pathsync.yml
File metadata and controls
56 lines (46 loc) · 1.71 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
name: Auto Sync Timetable Static Data
on:
repository_dispatch:
types: [sheet_updated]
workflow_dispatch:
jobs:
sync-and-build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pandas numpy google-api-python-client google-auth google-auth-oauthlib google-auth-httplib2 openpyxl psycopg2-binary requests
- name: Write Google OAuth Credentials
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
run: |
echo "$GOOGLE_CREDENTIALS" > credentials.json
echo "$GOOGLE_TOKEN" > token.json
- name: Rebuild SQLite Databases from Google Sheets
run: |
python rebuild_db.py
python rebuild_subjects.py
- name: Generate Obfuscated Static Binary Data
run: |
python generate_static_json.py
- name: Sync Faculty Schedules to Supabase
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
python sync_faculty_to_supabase.py
- name: Commit and Push Updated Data
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add frontend/data/ *.db
git diff --quiet && git diff --staged --quiet || (git commit -m "auto: sync timetable static data from Google Sheets" && git push)