diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml new file mode 100644 index 0000000..6f3ac39 --- /dev/null +++ b/.github/workflows/check-docs.yml @@ -0,0 +1,37 @@ +name: Check docs + +# Runs the knowledge base contract checks on every pull request, so a problem +# that would make the release-time publish fail shows up here first. +# +# The same checker publish-docs runs, but nothing is packed or released. +# Errors fail the check. Warnings are annotated on the run and listed in the +# job summary; add `strict: true` below to fail on warnings as well. +# +# This repo is the template other docs repos copy. Keep this file minimal: +# checkout, setup-python, the same build as pack.yml, one `uses:`. + +on: + pull_request: + +permissions: + contents: read + +jobs: + check: + name: Build headless + check against the knowledge base contract + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Build (headless) + run: python scripts/pack.py --headless + + - uses: AbsaOSS/knowledge-base/actions/check-docs@v1 + with: + manifest: kb-docs.json + dist: dist diff --git a/CLAUDE.md b/CLAUDE.md index fc19bf4..6299293 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -97,4 +97,5 @@ section: Optional Section Name - Normative spec: `contract/ARTIFACT.md`, `contract/HEADLESS_RULES.md`, `contract/kb-docs.schema.json` in AbsaOSS/knowledge-base - Publishing: `.github/workflows/pack.yml` runs on `release: published` (checkout → setup-python → `pack.py --headless` → `actions/publish-docs@v1`). Keep it minimal — this repo is the template other docs repos copy +- PR check: `.github/workflows/check-docs.yml` runs on `pull_request` with the same build, then `actions/check-docs@v1` (same contract checks, no release; errors fail, warnings annotated, `strict` off). Preview locally: `node ../knowledge-base/actions/lib/check-cli.js --manifest kb-docs.json --dist dist` - Registry entry in the knowledge base is just `{ "repo": "AbsaOSS/knowledge-base-docs-example", "version": "latest" }`; all display metadata lives in `kb-docs.json` here diff --git a/README.md b/README.md index 71bf500..4bc4392 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Built with [MkDocs](https://www.mkdocs.org/) — no Node.js required. | `kb-docs.json` | Knowledge base manifest (contract v1) | | `scripts/` | Build scripts (`pack.py`, `pack.sh`) | | `.github/workflows/pack.yml` | Publishes `kb-docs.tar.gz` to the knowledge base on every GitHub Release | +| `.github/workflows/check-docs.yml` | Runs the same contract checks on every pull request | ## Quick start @@ -73,6 +74,10 @@ to `AbsaOSS/knowledge-base/actions/publish-docs`, which validates them against t contract, packs `kb-docs.tar.gz` and attaches it to the release. The knowledge base fetches this artifact automatically. +The `Check docs` workflow runs the same checks on every pull request +(`AbsaOSS/knowledge-base/actions/check-docs`), without releasing anything. Errors fail +the pull request; warnings are annotated and listed in the job summary. + ## Registering in the knowledge base Add a two-line entry to `apps.json` in the knowledge base repo: