← Files ProdVerityARCHIVED FILE

source/.github/workflows/prodverity-vision-audit.yml

3.02 KB · Nov 15, 2026 · 06:42 UTC

↓ Download file

See the change to this file →

name: ProdVerity Vision Audit

on:
  pull_request:
    branches: [main]
    paths:
      - 'scripts/prodverity-vision-audit.mjs'
      - 'scripts/prodverity-vision-audit-lib.mjs'
      - 'scripts/prodverity-vision-audit.test.mjs'
      - '.github/workflows/prodverity-vision-audit.yml'
      - '.github/workflows/ci.yml'
      - 'package.json'
      - 'package-lock.json'
  workflow_dispatch:
  schedule:
    - cron: '47 6 * * *'
  workflow_run:
    workflows: ["GSA Production Deploy"]
    types: [completed]

permissions:
  contents: read

concurrency:
  group: prodverity-vision-audit
  cancel-in-progress: false

jobs:
  browser-render:
    if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
    runs-on: ubuntu-latest
    timeout-minutes: 12
    steps:
      - name: Checkout the exact auditor revision
        uses: actions/checkout@v4
        with:
          ref: ${{ github.event.workflow_run.head_sha || github.sha }}

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: npm

      - name: Install locked dependencies
        run: npm ci --no-audit --no-fund

      - name: Install Chromium for Playwright
        run: npx playwright install --with-deps chromium

      - name: Restore the immutable visual reference
        id: baseline
        uses: actions/cache/restore@v4
        with:
          path: audit-history/prodverity-vision-reference-v1
          key: prodverity-vision-reference-v1-${{ github.repository_id }}

      - name: Run Vision unit tests
        run: npm run prodverity:vision:test

      - name: Render public pages and collect browser evidence
        env:
          EXPECTED_REVISION: ${{ github.event.workflow_run.head_sha }}
          PRODVERITY_VISION_BASELINE_DIR: audit-history/prodverity-vision-reference-v1
        run: npm run prodverity:vision:audit

      - name: Stage the first successful immutable reference
        if: success() && steps.baseline.outputs.cache-hit != 'true' && github.event_name != 'pull_request'
        shell: bash
        run: |
          mkdir -p audit-history/prodverity-vision-reference-v1
          cp -R audit-artifacts/prodverity-vision/screenshots audit-history/prodverity-vision-reference-v1/screenshots
          cp audit-artifacts/prodverity-vision/reference-manifest.json audit-history/prodverity-vision-reference-v1/reference-manifest.json

      - name: Protect the first successful visual reference
        if: success() && steps.baseline.outputs.cache-hit != 'true' && github.event_name != 'pull_request'
        uses: actions/cache/save@v4
        with:
          path: audit-history/prodverity-vision-reference-v1
          key: prodverity-vision-reference-v1-${{ github.repository_id }}

      - name: Preserve screenshots, diffs and report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: prodverity-vision-${{ github.run_id }}
          path: audit-artifacts/prodverity-vision
          retention-days: 30
          if-no-files-found: warn

SHA-256: 257ed648099d1e61d6718517ea041b2d7840b9ae8b3bcfa189efd67a6ac42dfb