mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
Some checks failed
Argos CI / take-screenshots (push) Has been cancelled
Build Hash Router / Build Hash Router (push) Has been cancelled
Canary Release / Publish Canary (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Continuous Releases / Continuous Releases (push) Has been cancelled
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
74 lines
2.5 KiB
YAML
74 lines
2.5 KiB
YAML
name: Lighthouse Report
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- docusaurus-v**
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lighthouse-report:
|
|
permissions:
|
|
pull-requests: write # for marocchino/sticky-pull-request-comment
|
|
name: Lighthouse Report
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
|
with:
|
|
node-version: lts/*
|
|
cache: yarn
|
|
|
|
- name: Install dependencies
|
|
run: yarn || yarn || yarn
|
|
|
|
- name: Build website fast
|
|
run: yarn build:website:fast
|
|
|
|
- name: Audit URLs using Lighthouse
|
|
id: lighthouse_audit
|
|
uses: treosh/lighthouse-ci-action@fcd65974f7c4c2bf0ee9d09b84d2489183c29726 # 12.6.1
|
|
with:
|
|
urls: |
|
|
http://localhost:3000
|
|
http://localhost:3000/docs/installation
|
|
http://localhost:3000/docs/category/getting-started
|
|
http://localhost:3000/blog
|
|
http://localhost:3000/blog/preparing-your-site-for-docusaurus-v3
|
|
http://localhost:3000/blog/tags/release
|
|
http://localhost:3000/blog/tags
|
|
configPath: ./.github/workflows/lighthouserc.json
|
|
uploadArtifacts: true
|
|
temporaryPublicStorage: true
|
|
|
|
- name: Format lighthouse score
|
|
id: format_lighthouse_score
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # 8.0.0
|
|
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}/admin/scripts/formatLighthouseReport.js`)).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@773744901bac0e8cbb5a0dc842800d45e9b2b405 # 2.9.4
|
|
with:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
number: ${{ github.event.pull_request.number }}
|
|
header: lighthouse
|
|
message: ${{ steps.format_lighthouse_score.outputs.comment }}
|