# Library trace revalidation — weekly run + on-demand. ADR-022.
#
# Walks every approved + pre-shipped trace in docs/library-decisions/,
# re-runs each trace's verification-commands, classifies divergence as
# soft (minor drift → rolling dashboard issue) or hard (re-evaluation
# warranted → per-dep issue), and opens/updates/closes GitHub issues
# accordingly. Runs in parallel to main — does NOT gate deployments.

name: Library trace revalidation (weekly)

on:
  schedule:
    # 06:30 UTC every Monday
    - cron: "30 6 * * 1"
  workflow_dispatch:

permissions:
  contents: read
  issues: write

jobs:
  revalidate:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
        with:
          version: 9
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - name: Revalidate library traces
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: node scripts/library-decisions/revalidate.mjs
