Skip to content

Bump next from 13.3.1 to 13.5.4 #1218

Bump next from 13.3.1 to 13.5.4

Bump next from 13.3.1 to 13.5.4 #1218

name: Lighthouse Report
on:
pull_request:
branches: [main]
jobs:
lighthouse-report:
name: Lighthouse Report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Npm install and build
run: |
npm ci
npm run build
- name: Audit using Lighthouse
id: lighthouse_audit
uses: treosh/[email protected]
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
with:
configPath: './lighthouserc.json'
uploadArtifacts: true
temporaryPublicStorage: true
- name: Format lighthouse score
id: format_lighthouse_score
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[1].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
const comment = [
`⚡️ [Lighthouse report](${Object.values(links)[1]}) for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| ${score(result.performance)} Performance | ${result.performance} |`,
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
`| ${score(result.seo)} SEO | ${result.seo} |`,
`| ${score(result.pwa)} PWA | ${result.pwa} |`,
' ',
`*Lighthouse ran on ${Object.keys(links)[1]}*`
].join('\n')
core.setOutput("comment", comment);
- run: |
set -o pipefail
mkdir -p ./lighthouse
echo ${{ github.event.number }} | tee ./lighthouse/number
echo "${{ steps.format_lighthouse_score.outputs.comment }}" |& tee ./lighthouse/result
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' && (success() || failure()) }}
with:
name: lighthouse
path: lighthouse/