Skip to content

Lighthouse Report Cron #90

Lighthouse Report Cron

Lighthouse Report Cron #90

name: Lighthouse Report Cron
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
environment:
description: 'Environment to run LHCI against'
required: false
default: 'stage'
type: choice
options:
- stage
- prod
jobs:
lhci:
name: Lighthouse Report - ${{ inputs.environment != null && inputs.environment || 'stage' }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment != null && inputs.environment || 'stage' }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.9.x
uses: actions/setup-node@v4
with:
node-version: 20.9.x
- name: Run Lighthouse CI
run: |
npm install -g @lhci/cli@0.14.x
npm run lighthouse
env:
LIGHTHOUSE_COLLECT_URL: ${{ secrets.LIGHTHOUSE_COLLECT_URL }}
- name: Build cronjobs
run: |
npm ci
npm run build-cronjobs
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GC_LIGHTHOUSE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GC_LIGHTHOUSE_SERVICE_ACCOUNT }}
- name: Report results
run: npm run cron:report-lighthouse-results
env:
BQ_LIGHTHOUSE_PROJECT: ${{ secrets.BQ_LIGHTHOUSE_PROJECT }}
BQ_LIGHTHOUSE_DATASET: ${{ secrets.BQ_LIGHTHOUSE_DATASET }}
BQ_LIGHTHOUSE_TABLE: ${{ secrets.BQ_LIGHTHOUSE_TABLE }}