Skip to content

Daily Lighthouse audit #265

Daily Lighthouse audit

Daily Lighthouse audit #265

Workflow file for this run

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