Skip to content

Lighthouse - alarm on failure #96

Lighthouse - alarm on failure

Lighthouse - alarm on failure #96

Workflow file for this run

name: Lighthouse CI
on:
workflow_dispatch:
pull_request:
types: [labeled] # Only run when a PR is labeled with the 'Seen-on-PROD' label set by prout
jobs:
Lighthouse:
if: ${{ github.event.label.name == 'Seen-on-PROD' }}
runs-on: ubuntu-latest
env:
GOOGLE_CHAT_WEB_HOOK: ${{ secrets.GOOGLE_CHAT_WEB_HOOK }}
steps:
- uses: actions/checkout@v4
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
https://support.theguardian.com/uk/contribute
configPath: ./lighthouserc.json
uploadArtifacts: true # save results as an action artifacts
- name: Notify on failure
if: ${{ failure() }}
run: |
failedWorkflowRun="https://github.com/guardian/support-frontend/actions/runs/$GITHUB_RUN_ID"
prTrigger="https://github.com/guardian/support-frontend/pull/${{ github.event.number }}"
curl -X POST -H "Content-Type: application/json" "$GOOGLE_CHAT_WEB_HOOK" -d '{"text": "🚨 The Lighthouse performance tests for support-frontend have failed 🚨\n\n- <'"$failedWorkflowRun"'|You can see the reason for this failure on GitHub>. \n- <'"$prTrigger"'|PR that triggered this>.\n\n Has this introduced a performance regression or do the metrics need tweaking? "}'