| name: Lighthouse Report Cron |
|
|
| permissions: {} |
|
|
| 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@v6 |
| with: |
| persist-credentials: false |
| - name: Use Node.js 20.19.x |
| uses: actions/setup-node@v6 |
| with: |
| node-version: 20.19.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@v3 |
| 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 }} |
|
|