Daily Lighthouse audit #268
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: Daily Lighthouse audit | |
| on: | |
| schedule: | |
| - cron: "0 3 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| url: | |
| description: "URL to audit" | |
| required: false | |
| default: "https://kollitsch.dev/" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: lighthouse-daily | |
| cancel-in-progress: true | |
| jobs: | |
| audit: | |
| name: Lighthouse CI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run Lighthouse CI | |
| env: | |
| LH_URL: ${{ github.event.inputs.url || 'https://kollitsch.dev/' }} | |
| run: node src/scripts/linting/lighthouse-ci.ts | |
| - name: Upload JSON reports | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: lighthouse-reports-${{ github.run_id }} | |
| path: reports/lighthouse/*.json | |
| if-no-files-found: error | |
| retention-days: 30 | |
| - name: Commit history update | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add src/data/lighthouse/history.json | |
| MSG="chore(lighthouse): update score history [skip ci]" | |
| git diff --cached --quiet || git commit -m "${MSG}" | |
| REMOTE="https://x-access-token:${GITHUB_TOKEN}" | |
| REMOTE="${REMOTE}@github.com/${GITHUB_REPOSITORY}.git" | |
| git push "${REMOTE}" HEAD |