Run check in CI

Build the site and run contentbit check in CI, so a broken link or a missing title fails the pull request before the deploy.

contentbit check exits 1 when it reports an error. Run it in CI after the step that builds the site, and the job fails on the same findings you see locally.

Write the GitHub Actions job

Run init with --ci github:

npx contentbit@latest init --ci github

init writes .github/workflows/contentbit.yml. It fills in the project's package manager and its version, runs the build script, then runs the content:check script that init adds. The job runs on pull requests and on pushes to the repository's default branch. On a pnpm project:

name: contentbit

on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: pnpm/action-setup@v6
        with:
          version: 12
      - uses: actions/setup-node@v7
        with:
          node-version: 24
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - name: Build the site
        run: pnpm run build
      - name: Check the built pages
        run: pnpm run content:check

init takes the package manager from the lockfile, in the project's folder or above it, up to the repository root. For Yarn 2 and later, the job runs corepack enable first. When the project sits in a folder below the root of its repository, as in a monorepo, init writes the workflow at the root, where GitHub reads it, and runs the job's steps in the project's folder with defaults.run.working-directory.

init never overwrites a workflow file. When contentbit.yml already exists, it prints the steps for you to add to a job:

skipped: .github/workflows/contentbit.yml already exists. Add these steps to its job:
  - uses: actions/checkout@v7
  - uses: pnpm/action-setup@v6
    with:
      version: 12
  - uses: actions/setup-node@v7
    with:
      node-version: 24
      cache: pnpm
  - run: pnpm install --frozen-lockfile
  - name: Build the site
    run: pnpm run build
  - name: Check the built pages
    run: pnpm run content:check

Add the steps to another CI

Any CI that runs Node.js 22.18 or newer can run the check. Give the job three steps, in this order:

  1. Install the dependencies.
  2. Build the site with its own build command.
  3. Run contentbit check, or the content:check script.

Build before the check. init sets site.build to the folder the build writes, and check exits 2 when that folder is missing or holds no HTML page, so the job fails on a site that renders on a server instead of passing on the Markdown alone. If the build writes to another folder, set site.build in contentbit.config.ts or pass the folder:

contentbit check apps/web/dist

Choose what fails the job

By default, the job fails on errors only. Add a flag to the content:check script in package.json to fail on more:

ScriptThe job fails on
contentbit checkErrors.
contentbit check --strict-seoErrors, and warnings from the SEO contract of a page type.
contentbit check --strictErrors and every warning.

info findings never fail the job. Each code's severity is in Finding codes. When a finding is there on purpose, ignore it or change its severity in the config, as Ignore a finding shows, instead of loosening the job.

check exits 2 when it has nothing to check, when the build folder you name does not exist or holds no HTML page, or when an option value is invalid. A misconfigured job fails instead of passing on an empty check.

Read the result

The job log shows the same report as your terminal: built-page findings, then Markdown findings, then the counts. For a script that posts comments or annotations, run contentbit check --json. It prints one contentbit.site-check.v1 report with every finding, its code, and the file and line or page it points at. See check --json.