Skip to content

Commit 6f229b5

Browse files
committed
test
1 parent d110482 commit 6f229b5

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

.github/workflows/web-app-deployer.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -351,28 +351,31 @@ jobs:
351351
with:
352352
github-token: ${{secrets.GITHUB_TOKEN}}
353353
script: |
354-
const result = ${{ steps.lighthouse-check.outputs.manifest }}[0].summary
355-
const links = ${{ steps.lighthouse-check.outputs.links }}
356-
357-
const formatResult = (res) => Math.round((res * 100))
358-
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
359-
360-
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
361-
362-
const comment = [
363-
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
364-
'| Category | Score |',
365-
'| --- | --- |',
366-
`| ${score(result.performance)} Performance | ${result.performance} |`,
367-
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
368-
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
369-
`| ${score(result.seo)} SEO | ${result.seo} |`,
370-
`| ${score(result.pwa)} PWA | ${result.pwa} |`,
371-
' ',
372-
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
373-
].join('\n')
374-
375-
core.setOutput("comment", comment);
354+
const results = ${{ steps.lighthouse-check.outputs.manifest }}
355+
let comment = []
356+
results.forEach(resultData => {
357+
const result = resultData.summary;
358+
const links = ${{ steps.lighthouse-check.outputs.links }}
359+
360+
const formatResult = (res) => Math.round((res * 100))
361+
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
362+
363+
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
364+
365+
comment.concat([
366+
`*Lighthouse ran on [${resultData.url}](${resultData.url})* (Desktop)`
367+
`⚡️ HTML Report [Lighthouse report](${links[resultData.url]}) for the changes in this PR:`,
368+
'| Performance | Accessibility | Best Practices | SEO |',
369+
'| --- | --- | --- | --- |',
370+
`| ${score(result.performance)} ${result.performance} | ${score(result.accessibility)} ${result.accessibility} | ${score(result['best-practices'])} ${result['best-practices']} | ${score(result.seo)} ${result.seo} |`,
371+
' ',
372+
' ',
373+
])
374+
})
375+
const finalComment = comment.join('\n')
376+
core.setOutput("comment", finalComment);
377+
378+
376379
377380
- name: Add lighthouse comment to PR
378381
id: comment_to_pr

0 commit comments

Comments
 (0)