Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Lighthouse report

on:
pull_request:
types: [opened, synchronize]

permissions:
contents: read
pull-requests: write

jobs:
lighthouse:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest

steps:
- name: Checkout PR code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Setup Node.js with npm cache
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'

- name: Install dependencies
run: npm install @unlighthouse/cli puppeteer

- name: Wait for Netlify preview to be live
run: |
PREVIEW_URL="https://deploy-preview-${{ github.event.pull_request.number }}--expressjscom-preview.netlify.app"
echo "PREVIEW_URL=$PREVIEW_URL" >> "$GITHUB_ENV"
for i in {1..2}; do
if curl -s --head "$PREVIEW_URL" | grep "200 OK" > /dev/null; then
echo "Preview is live!"
break
fi
echo "Waiting for Netlify to deploy... ($i/2)"
sleep 10
done

- name: Unlighthouse assertions and client
run: npx unlighthouse-ci --site "$PREVIEW_URL" --mobile --urls /en/5x/api --samples 1 --disable-dynamic-sampling --disable-sitemap --disable-robots-txt

- name: 📄 Log results
run: cat ./.unlighthouse/ci-result.json