Update Traffic Views #715
This file contains 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 Traffic Views | |
on: | |
schedule: | |
- cron: '10 */12 * * *' | |
push: | |
paths: | |
- docs/traffic/all.json | |
jobs: | |
update-traffic-views: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install --production | |
- name: Run update-traffic-views script | |
env: | |
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GITHUB_TOKEN }} | |
GITHUB_USER: toFrankie | |
GITHUB_REPO: blog | |
run: bun run scripts/update-traffic-views.ts | |
- name: Check if traffic-views.svg has changed | |
id: check_changes | |
run: | | |
git diff --exit-code docs/traffic-views.svg || echo "file_changed=true" >> $GITHUB_ENV | |
- name: Commit changes | |
if: env.file_changed == 'true' | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add docs/traffic-views.svg | |
git commit -m "docs: update traffic views" | |
git push origin main |