Publish Lighthouse Scores for Key Pages with GitHub Actions

GitHub Workflows

Publish Lighthouse Scores for Key Pages with GitHub Actions

Test common pages across environments and publish Lighthouse performance, accessibility, best-practices, and SEO scores.

A deployment can succeed technically while making important pages slower, less accessible, or harder for search engines to understand. Lighthouse provides a repeatable health snapshot for commonly visited pages.

The Swift workflow audits the homepage, sign-in page, APIs, partners, support, and news. It publishes Performance, Accessibility, Best Practices, and SEO scores in the GitHub Actions job summary.

Environment-aware execution

  • Opening a release pull request into main tests Stage.
  • Merging into develop tests DEV.
  • Merging into main tests Production.
  • A manual run can select dev, stage, or production.
lighthouse "$url" \
  --output=json \
  --output-path="$report" \
  --chrome-flags="--headless --no-sandbox" \
  --preset=desktop \
  --only-categories=performance,accessibility,best-practices,seo \
  --quiet

The script reads the JSON with jq, converts category scores to percentages, and appends a Markdown table row to $GITHUB_STEP_SUMMARY. Each page links to its environment URL.

Reporting rather than blocking

Scores vary with network conditions, load, caches, consent dialogs, and third-party services. A single synthetic run should not automatically block deployment. A failed page produces a warning and an N/A row while remaining pages continue.

Compare trends for the same page and environment. For stronger governance, archive JSON reports, run pages multiple times, and use median scores. Lighthouse complements real-user monitoring, automated accessibility checks, and functional tests.

Keep reading