Update Workshop Data from Google Sheets #2
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: Update Workshop Data from Google Sheets | |
| on: | |
| schedule: | |
| # Run daily at 8 AM UTC (1 AM PST) | |
| - cron: '0 8 * * *' | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| update-workshops: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client | |
| - name: Fetch workshop data from Google Sheets | |
| env: | |
| GOOGLE_SHEET_ID: ${{ secrets.GOOGLE_SHEET_ID }} | |
| GOOGLE_SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }} | |
| run: | | |
| python scripts/fetch_google_sheets.py | |
| - name: Commit and push changes | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add _data/upcoming_workshops.json | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update upcoming workshops data [skip ci]" | |
| git push | |
| fi |