Skip to content

Check external data sources #283178

Check external data sources

Check external data sources #283178

name: Check external data sources
on:
workflow_dispatch:
concurrency:
group: publish
jobs:
check:
outputs:
diff: ${{ steps.diff.outputs.diff }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- uses: actions/cache/restore@v4
with:
key: external-data
path: 11ty/data/external
- id: diff
name: Check sources
env:
GH_TOKEN: ${{ github.token }}
TWITCH_CLIENT_ID: ${{ secrets.TWITCH_CLIENT_ID }}
TWITCH_CLIENT_SECRET: ${{ secrets.TWITCH_CLIENT_SECRET }}
TWITCH_USERNAME: ${{ secrets.TWITCH_USERNAME }}
YT_API_KEY: ${{ secrets.YT_API_KEY }}
run: |
# clear cache
gh cache delete external-data || true
# compare API response with locally cached JSON data
npm run build:ts
diff=0
npm run check || diff=1
echo "diff=$diff" >> "$GITHUB_OUTPUT"
- uses: actions/cache/save@v4
with:
key: external-data
path: 11ty/data/external
- if: steps.diff.outputs.diff == '1'
name: Build site
run: npm run build:11ty
- if: steps.diff.outputs.diff == '1'
uses: actions/upload-pages-artifact@v3
with:
path: docs/
deploy:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.diff == '1'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4