Update events calendar #237
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 events calendar | |
| on: | |
| schedule: | |
| - cron: "0 7 * * *" # every day at midnight Vancouver time | |
| workflow_dispatch: | |
| jobs: | |
| scrape-events: | |
| runs-on: ubuntu-latest | |
| env: | |
| # necessary for using `gh` cli | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| # scrapes luma and updates events.json | |
| - name: Run events scraping script | |
| run: npm run scrape-events | |
| # check if events.json has changed, and if so, commit, push, and trigger deploy workflow | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "github-actions@github.com" | |
| git config --global user.name "GitHub Actions" | |
| - name: Commit and push changes | |
| run: | | |
| if git diff --exit-code events.json; then | |
| echo "No event updates" | |
| else | |
| echo "Changes detected - committing new events.json" | |
| git add events.json | |
| git commit -m "Update events calendar [automated]" | |
| git push | |
| # workflows do not trigger other workflows by default when using the default auth token | |
| # so instead we will trigger a new deploy manually | |
| gh workflow run deploy.yml | |
| fi |