Files
openclaw/.github/workflows/docs-mirror-freshness.yml
Peter Steinberger 5f8fd586e7 feat(ci): alarm and self-heal when the docs mirror goes stale (#131173)
Both halves of the docs publish starvation bug (openclaw/docs b4b130bd8,
#131155) were discovered by noticing stale published docs, not by any alert:
nothing watched whether the openclaw/docs mirror actually tracked docs-touching
commits on main. A broken sync (dead token, MDX failure, disabled workflow,
GitHub incident) would again go unnoticed.

Add a scheduled Docs Mirror Freshness check (every 30m) that parses the watched
paths from docs-sync-publish.yml itself - so the staleness definition can never
drift from the sync trigger - finds the newest docs-touching main commit via
the commits API, and compares it against the mirror's .openclaw-sync/source.json
SHA. When the mirror trails by more than 60 minutes it dispatches one
docs-sync-publish recovery run (skipped when a sync is already queued or in
progress) and fails the run so the workflow actor is notified.

The check lives in openclaw/openclaw rather than openclaw/docs because the path
filters it must judge against live here, and same-repo workflow_dispatch heals
with the default GITHUB_TOKEN instead of a cross-repo PAT.

Live-proven: fresh path against the real repos; stale path (detection,
active-run suppression, failing exit) via a simulated stale mirror SHA;
recovery dispatch endpoint via a real manual sync run (33113089552).
2026-08-27 13:45:14 -07:00

37 lines
1.1 KiB
YAML

name: Docs Mirror Freshness
# Freshness alarm for the docs publish pipeline: docs-sync-publish.yml mirrors
# docs into openclaw/docs, but a broken sync leaves the mirror silently stale.
# This check fails (notifying the workflow actor) when the mirror trails a
# docs-touching main commit by more than the grace window, after dispatching
# one recovery sync.
on:
schedule:
- cron: "17,47 * * * *"
workflow_dispatch:
permissions:
contents: read
# Needed to dispatch a docs-sync-publish.yml recovery run when stale.
actions: write
jobs:
check-mirror-freshness:
runs-on: ubuntu-latest
steps:
- name: Checkout source repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24.x"
- name: Check docs mirror freshness
env:
GITHUB_TOKEN: ${{ github.token }}
run: node scripts/docs-mirror-freshness.mjs