Skip to content

Update Component Library documentation #1712

Update Component Library documentation

Update Component Library documentation #1712

name: "CI - Lighthouse website audit Report"
on:
pull_request_target:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lighthouse-report:
name: Lighthouse website audit Report
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Wait for the Netlify Preview
uses: andrewnicols/[email protected]
id: netlify
with:
site_id: "3c056055-e1bd-4cfd-8a02-ed35ab7aedfa"
max_timeout: 900
netlify_secret: ${{ secrets.NETLIFY_SECRET }}
- name: Audit URLs using Lighthouse
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@b4dfae3eb959c5226e2c5c6afd563d493188bfaf # 9.3.0
with:
urls: |
${{ steps.netlify.outputs.deployUrl }}/
${{ steps.netlify.outputs.deployUrl }}/docs/apis/commonfiles
${{ steps.netlify.outputs.deployUrl }}/general/development/gettingstarted
${{ steps.netlify.outputs.deployUrl }}/general/releases
configPath: ./.github/workflows/lighthouserc.json
uploadArtifacts: true
temporaryPublicStorage: true
env:
PR_NUMBER: ${{ github.event.pull_request.number}}
- name: Format lighthouse score
id: format_lighthouse_score
uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e # v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const results = ${{ steps.lighthouse_audit.outputs.manifest }}
const links = ${{ steps.lighthouse_audit.outputs.links }}
const createLighthouseReport = (await import(`${process.env.GITHUB_WORKSPACE}/scripts/format-lighthouse-score.mjs`)).default;
const comment = createLighthouseReport({ results, links });
core.setOutput("comment", comment);
- name: Add Lighthouse stats as comment
id: comment_to_pr
uses: marocchino/sticky-pull-request-comment@39c5b5dc7717447d0cba270cd115037d32d28443 # v2.2.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: lighthouse
message: ${{ steps.format_lighthouse_score.outputs.comment }}