Data Import from Supabase #1478
This file contains hidden or 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: Data Import from Supabase | |
| on: | |
| schedule: | |
| - cron: '30 7 * * *' # 07:30 UTC - after the Supabase pipeline's overnight runs finish (~07:00) | |
| - cron: '30 17 * * *' # 17:30 UTC - evening refresh | |
| workflow_dispatch: # Manual run always available | |
| concurrency: | |
| group: update-data | |
| cancel-in-progress: false | |
| jobs: | |
| export-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Important for git history | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pandas numpy supabase python-dotenv | |
| - name: Process FPL data | |
| env: | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }} | |
| run: python scripts/export_data.py | |
| - name: Commit and push changes (Data Export) | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add data/ | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "Auto-update FPL data $(date +'%Y-%m-%d %H:%M UTC')" && git push) |