Audit your docs in CI
An audit reviews every page at the end of a build and fails the build when it finds errors.
Audits only run when the STARLIGHT_COMPASS_AUDIT environment variable is set, so local builds and deployments stay offline.
-
Declare the intended type of your pages with the
diataxisfrontmatter field. -
Add your TypeSafe API key as a secret named
TYPESAFE_API_KEYin your repository settings. -
Add a workflow that builds your docs with
STARLIGHT_COMPASS_AUDIT=1. For example, with GitHub Actions and pnpm:.github/workflows/docs-audit.yaml name: Docs auditon:pull_request:jobs:audit:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v5- uses: pnpm/action-setup@v4- uses: actions/setup-node@v5with:cache: pnpm- run: pnpm install- uses: actions/cache@v4with:path: node_modules/.astro/starlight-compasskey: starlight-compass-${{ github.sha }}restore-keys: starlight-compass-- run: pnpm buildenv:STARLIGHT_COMPASS_AUDIT: 1TYPESAFE_API_KEY: ${{ secrets.TYPESAFE_API_KEY }}Caching the
starlight-compassdirectory in Astro’scacheDirmeans only changed pages are sent to the provider. -
Open a pull request. The build log groups errors and warnings by file, for example:
╭─ src/content/docs/guides/deploy.md·✗ | Declared as a tutorial but reads like a how-to guide (84% confidence).· ╰── diataxis╭─ src/content/docs/concepts/routing.md·⚠ | Mixes several documentation types and could be split into separate pages (72% probability).· ╰── diataxis╭─ ─╮· Found 1 error and 1 warning in 2 files. ·╰─ ─╯In GitHub Actions, the same findings also appear as a table in the job summary, with links to the files.
To also fail on warnings, or to only report findings, set the audit.failOn option.