Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Lighthouse CI integration to automatically generate public performance reports for the deployed GitHub Pages site. The workflow runs after successful deployment to audit the site's performance, accessibility, best practices, and SEO metrics.
Key Changes:
- New
lighthouserc.jsconfiguration file for Lighthouse CI with temporary public storage - New
lighthousejob in the deploy workflow that runs after site deployment
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lighthouserc.js | Adds Lighthouse CI configuration with temporary public storage for report uploads |
| .github/workflows/deploy.yml | Adds new lighthouse job that installs dependencies, builds the site, and runs Lighthouse CI audits after deployment |
| - name: npm install, build | ||
| run: | | ||
| npm install | ||
| npm run build | ||
|
|
||
| - name: run Lighthouse CI | ||
| run: | | ||
| npm install -g @lhci/cli@0.15.x | ||
| lhci autorun |
There was a problem hiding this comment.
The Lighthouse job is rebuilding the site unnecessarily. Since this job runs after deployment (needs: deploy), it should test the deployed GitHub Pages URL directly rather than rebuilding locally. The lhci autorun command can be configured in lighthouserc.js to test the deployed URL, eliminating the need for these build steps.
| - name: npm install, build | |
| run: | | |
| npm install | |
| npm run build | |
| - name: run Lighthouse CI | |
| run: | | |
| npm install -g @lhci/cli@0.15.x | |
| lhci autorun | |
| # Removed unnecessary local build; test deployed site directly | |
| - name: run Lighthouse CI | |
| run: | | |
| npm install -g @lhci/cli@0.15.x | |
| lhci autorun | |
| env: | |
| LHCI_BUILD_CONTEXT__CURRENT_BRANCH: ${{ github.ref_name }} | |
| LHCI_BUILD_CONTEXT__CURRENT_HASH: ${{ github.sha }} | |
| LHCI_BUILD_CONTEXT__CURRENT_URL: ${{ needs.deploy.outputs.page_url }} |
| module.exports = { | ||
| ci: { | ||
| upload: { | ||
| target: "temporary-public-storage", | ||
| }, | ||
| }, |
There was a problem hiding this comment.
The Lighthouse configuration is missing a URL to test. The lighthouserc.js file needs a "collect" section that specifies the deployed GitHub Pages URL. Without this, lhci autorun won't know which URL to audit. Consider adding the deployed site URL from the deploy job's output.
Related issue #39
This PR proposes to add a workflow which generates a (public) lighthouse report.