docs(asyncapi-document): improve writing style #8828
Workflow file for this run
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
name: Lighthouse CI | |
on: | |
pull_request_target: | |
branches: | |
- master | |
types: [opened, reopened, synchronize, ready_for_review] | |
jobs: | |
lighthouse-ci: | |
name: Lighthouse CI | |
runs-on: ubuntu-latest | |
steps: | |
- if: > | |
!github.event.pull_request.draft && !( | |
(github.actor == 'asyncapi-bot' && ( | |
startsWith(github.event.pull_request.title, 'ci: update global workflows') || | |
startsWith(github.event.pull_request.title, 'chore: update code of conduct') || | |
startsWith(github.event.pull_request.title, 'ci: update global contribution guide') || | |
startsWith(github.event.pull_request.title, 'ci: update workflows for go projects') || | |
startsWith(github.event.pull_request.title, 'ci: update workflows for nodejs projects') || | |
startsWith(github.event.pull_request.title, 'ci: update release-related workflows for nodejs projects') || | |
startsWith(github.event.pull_request.title, 'ci: update semantic release config file') || | |
startsWith(github.event.pull_request.title, 'ci: update generic workflows') || | |
startsWith(github.event.pull_request.title, 'ci: update workflows for docker-based projects') || | |
startsWith(github.event.pull_request.title, 'chore(release):') | |
)) || | |
(github.actor == 'allcontributors[bot]' && | |
startsWith(github.event.pull_request.title, 'docs: add') | |
) | |
) | |
id: should_run | |
name: Should Run | |
run: echo "shouldrun=true" >> $GITHUB_OUTPUT | |
- if: steps.should_run.outputs.shouldrun == 'true' | |
uses: actions/checkout@v3 | |
- if: steps.should_run.outputs.shouldrun == 'true' | |
name: Await Netlify Preview | |
uses: jakepartusch/wait-for-netlify-action@f1e137043864b9ab9034ae3a5adc1c108e3f1a48 #version 1.4 https://github.com/JakePartusch/wait-for-netlify-action/releases/tag/v1.4 | |
id: netlify | |
with: | |
site_name: asyncapi-website | |
max_timeout: 600 | |
- if: steps.should_run.outputs.shouldrun == 'true' | |
name: Lighthouse Audit | |
id: lighthouse_audit | |
uses: treosh/lighthouse-ci-action@03becbfc543944dd6e7534f7ff768abb8a296826 #version 10.1 https://github.com/treosh/lighthouse-ci-action/releases/tag/10.1.0 | |
with: | |
urls: | | |
https://deploy-preview-$PR_NUMBER--asyncapi-website.netlify.app/ | |
configPath: ./.github/workflows/lighthouserc.json | |
uploadArtifacts: true | |
temporaryPublicStorage: true | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number}} | |
- if: steps.should_run.outputs.shouldrun == 'true' | |
name: Lighthouse Score Report | |
id: lighthouse_score_report | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].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)[0]}) 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)[0]}](${Object.keys(links)[0]})*` | |
].join('\n') | |
core.setOutput("comment", comment); | |
- if: steps.should_run.outputs.shouldrun == 'true' | |
name: LightHouse Statistic Comment | |
id: lighthouse_statistic_comment | |
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd # version 2.8 https://github.com/marocchino/sticky-pull-request-comment/releases/tag/v2.8.0 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
number: ${{ github.event.pull_request.number }} | |
header: lighthouse | |
message: ${{ steps.lighthouse_score_report.outputs.comment }} |