Skip to content

Trigger Site Rebuild on a CRON Schedule #12973

Trigger Site Rebuild on a CRON Schedule

Trigger Site Rebuild on a CRON Schedule #12973

Workflow file for this run

# .github/workflows/scheduled-builds.yml
name: Trigger Site Rebuild on a CRON Schedule
on:
schedule:
# Runs "every hour" (see https://crontab.guru)
- cron: '0 * * * *'
workflow_dispatch:
jobs:
build:
name: Trigger Site Rebuild
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Install dependencies
run: make install
- name: Run update Strava
# Forces refresh of the token
env:
STRAVA_CLIENT_ID: ${{ secrets.STRAVA_CLIENT_ID }}
STRAVA_CLIENT_SECRET: ${{ secrets.STRAVA_CLIENT_SECRET }}
STRAVA_ACCESS_TOKEN: ${{ secrets.STRAVA_ACCESS_TOKEN }}
STRAVA_REFRESH_TOKEN: ${{ secrets.STRAVA_REFRESH_TOKEN }}
TOKEN_EXPIRES_AT: ${{ secrets.TOKEN_EXPIRES_AT }}
run: python python/main_strava.py
- name: Modify refresh token
uses: gliech/create-github-secret-action@v1
with:
name: STRAVA_REFRESH_TOKEN
value: ${{ env.STRAVA_REFRESH_TOKEN }}
pa_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Run update Spotify
env:
SPOTIPY_CLIENT_ID: ${{ secrets.SPOTIPY_CLIENT_ID }}
SPOTIPY_CLIENT_SECRET: ${{ secrets.SPOTIPY_CLIENT_SECRET }}
run: python python/main_spotify.py
- name: Add & Commit
uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
# The arguments for the `git add` command (see the paragraph below for more info)
# Default: '.'
add: '_posts assets _includes'
# The name of the user that will be displayed as the author of the commit.
# Default: depends on the default_author input
author_name: Strava
# The message for the commit.
# Default: 'Commit from GitHub Actions (name of the workflow)'
message: 'Auto-added Strava activity'
# Whether to push the commit and, if any, its tags to the repo. It can also be used to set the git push arguments (see the paragraph below for more info)
# Default: true
push: true