Lighthouse Checks #55
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 Checks | |
on: | |
schedule: | |
# At 1:00pm on the 15th of each month | |
- cron: "0 13 15 * *" | |
workflow_dispatch: | |
pull_request: | |
branches: [main] | |
paths: | |
- ".github/workflows/Lighthouse.yml" | |
env: | |
websiteUrl: 'https://azure.github.io/AKS-Construction' | |
outputdir: ${{ github.workspace }}/lighthouseOut | |
jobs: | |
lighthouse: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Prep file system | |
run: mkdir ${{ env.outputdir }} | |
- name: Lighthouse Checks | |
uses: foo-software/[email protected] | |
id: lighthouseCheck | |
with: | |
urls: ${{ env.websiteUrl }} | |
outputDirectory: ${{ env.outputdir }} | |
- name: Upload Lighthouse report | |
uses: actions/[email protected] | |
with: | |
name: Lighthouse reports | |
path: ${{ env.outputdir }} | |
- name: Parse Output and raise issues | |
shell: pwsh | |
env: | |
resultsJsonPath: ${{ env.outputdir }}/results.json | |
minAccessibilityScore: "90" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
$results = Get-Content $Env:resultsJsonPath | ConvertFrom-Json | |
Write-Output $results.scores | |
if ($results.scores.accessibility -lt $Env:minAccessibilityScore) { | |
Write-Output "Creating Accessibility issue, scored less than threshold" | |
$workflowLink = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" | |
Write-Output $workflowLink | |
gh issue create --title "Accessibility issues identified [bot]" --body "Lighthouse web checking shows that Accessibility scores less than the defined threshold. See more $workflowLink" --label "needs-triage :mag_right:,helper-ui :mage_woman:" | |
} | |
# - name: Enforce minimum Lighthouse Check results | |
# uses: foo-software/lighthouse-check-status-action@master | |
# with: | |
# lighthouseCheckResults: ${{ steps.lighthouseCheck.outputs.lighthouseCheckResults }} | |
# minAccessibilityScore: "85" | |
# minBestPracticesScore: "90" | |
# #minPerformanceScore: "50" | |
# minProgressiveWebAppScore: "50" | |
# minSeoScore: "50" | |