Sync Strava Activities #2759
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 Strava Activities | |
| on: | |
| schedule: | |
| - cron: '55 * * * *' # Run hourly at 55 minutes past the hour | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| actions: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v5 | |
| with: | |
| cache: true | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Create .env file | |
| run: | | |
| echo "STRAVA_CLIENT_ID=${{ secrets.STRAVA_CLIENT_ID }}" >> .env | |
| echo "STRAVA_CLIENT_SECRET=${{ secrets.STRAVA_CLIENT_SECRET }}" >> .env | |
| echo "STRAVA_REFRESH_TOKEN=${{ secrets.STRAVA_REFRESH_TOKEN }}" >> .env | |
| - name: Run Strava sync | |
| run: pnpm run sync:strava:activities | |
| - name: Commit and push changes | |
| id: commit | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: π Sync Strava activities | |
| file_pattern: data/strava/activities/ | |
| - name: Trigger deploy workflow | |
| if: steps.commit.outputs.changes_detected == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: 'deploy.yml', | |
| ref: 'main' | |
| }) |