Skip to content

Commit

Permalink
one more time
Browse files Browse the repository at this point in the history
  • Loading branch information
arzafran committed Sep 26, 2024
1 parent 15f70bf commit 0de3f29
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/lighthouse-on-vercel-preview-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,21 @@ jobs:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const link = ${{ steps.lighthouse_audit.outputs.manifest }}[0].url
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)[0]}) for the changes in this commit:`,
'',
`${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}`,
' ',
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
].join('\n')
`*Lighthouse ran on ${link}
core.setOutput("comment", comment);
- name: Create commit comment
uses: peter-evans/commit-comment@v3
with:
body: |
"${{ steps.format_lighthouse_score.outputs.comment }}"
"${{ steps.format_lighthouse_score.outputs.comment }}"

0 comments on commit 0de3f29

Please sign in to comment.