-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devops: debug lhci results comment (#78)
* devops: debug github actions * devops: debug lhci results comment
- Loading branch information
1 parent
876c1ee
commit 99da3ed
Showing
1 changed file
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,29 +50,29 @@ jobs: | |
const manifest = ${{ toJSON(steps.lighthouse_audit.outputs.manifest) }}; | ||
const links = ${{ toJSON(steps.lighthouse_audit.outputs.links) }}; | ||
if (!manifest || Object.keys(manifest).length === 0) { | ||
core.setFailed('Lighthouse audit did not generate any results.'); | ||
return; | ||
} | ||
# if (!manifest || Object.keys(manifest).length === 0) { | ||
# core.setFailed('Lighthouse audit did not generate any results.'); | ||
# return; | ||
# } | ||
const formatResult = (res) => Math.round((res * 100)); | ||
const score = (res) => (res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'); | ||
# const formatResult = (res) => Math.round((res * 100)); | ||
# const score = (res) => (res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'); | ||
let comment = ''; | ||
# let comment = ''; | ||
Object.keys(manifest).forEach((page) => { | ||
const pageLink = manifest[page].url; | ||
comment += `*Lighthouse ran on [${pageLink}](${pageLink})*\n\n`; | ||
comment += '| Category | Score |\n'; | ||
comment += '| --- | --- |\n'; | ||
const result = manifest[page].summary; | ||
Object.keys(result).forEach((key) => { | ||
const formattedScore = formatResult(result[key]); | ||
comment += `| ${score(result[key])} ${key} | ${formattedScore} |\n`; | ||
}); | ||
}); | ||
# Object.keys(manifest).forEach((page) => { | ||
# const pageLink = manifest[page].url; | ||
# comment += `*Lighthouse ran on [${pageLink}](${pageLink})*\n\n`; | ||
# comment += '| Category | Score |\n'; | ||
# comment += '| --- | --- |\n'; | ||
# const result = manifest[page].summary; | ||
# Object.keys(result).forEach((key) => { | ||
# const formattedScore = formatResult(result[key]); | ||
# comment += `| ${score(result[key])} ${key} | ${formattedScore} |\n`; | ||
# }); | ||
# }); | ||
core.setOutput('comment', comment); | ||
core.setOutput('comment', steps.lighthouse_audit.outputs.links); | ||
- name: Add comment to PR | ||
id: comment_to_pr | ||
uses: marocchino/[email protected] | ||
|