Sync Drive Resources #3
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: Sync Drive Resources | |
| on: | |
| schedule: | |
| # Every Monday at 06:00 UTC | |
| - cron: "0 6 * * 1" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Run Drive sync | |
| env: | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| DRIVE_FOLDER_ID: ${{ secrets.PEN_REPO_DRIVE_LINK }} | |
| run: python sync/sync_drive.py | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| git diff --quiet data/resources.json && echo "changed=false" >> "$GITHUB_OUTPUT" || echo "changed=true" >> "$GITHUB_OUTPUT" | |
| - name: Commit and push | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add data/resources.json | |
| git commit -m "chore: sync clinical resources from Google Drive | |
| Auto-generated by sync-resources workflow" | |
| git push |