diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 40a8413494..710a530a1a 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -7,6 +7,8 @@ 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 @@ -16,3 +18,9 @@ jobs: 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? "}' diff --git a/lighthouserc.json b/lighthouserc.json index d283a83324..1ecf896e5f 100644 --- a/lighthouserc.json +++ b/lighthouserc.json @@ -2,9 +2,9 @@ "ci": { "assert": { "assertions": { - "first-contentful-paint": ["error", { "maxNumericValue": 2500 }], - "largest-contentful-paint": ["error", { "maxNumericValue": 6000 }], - "interactive": ["error", { "maxNumericValue": 8000 }], + "first-contentful-paint": ["error", { "maxNumericValue": 3000 }], + "largest-contentful-paint": ["error", { "maxNumericValue": 7000 }], + "interactive": ["error", { "maxNumericValue": 9500 }], "resource-summary:document:size": [ "error", { "maxNumericValue": 20000 }