Skip to main content
Running the Mintlify CLI in your continuous integration pipeline catches broken links, invalid configuration, and OpenAPI errors before they reach your live documentation. This guide covers common CI setups and which commands to run.
Mintlify’s hosted CI checks run automatically on pull requests without any pipeline configuration. Use this guide when you want to run the CLI in your own pipeline, gate merges on additional checks, or run validation outside GitHub.

Which commands to run

The CLI includes three commands well suited to CI: Each command exits with a non-zero status code when it finds errors, which fails the CI job.

GitHub Actions

Add a workflow file at .github/workflows/docs-check.yml:
The paths filter skips the workflow on pull requests that don’t touch documentation files, saving CI minutes.

GitLab CI

Add the following to .gitlab-ci.yml:

Pre-commit hook

Run the same checks locally before pushing by adding a pre-commit hook. Create .git/hooks/pre-commit and make it executable:
For team-wide enforcement, use a tool like Husky to check the hook into version control.

Scope checks to changed files

On large documentation sites, running the full link checker on every pull request can be slow. Pass --files to mint broken-links to scope the check to files that changed in the pull request. The following GitHub Actions step checks only pages modified in the pull request:
Run the full check on a schedule instead, so you still catch links that break because a page was renamed elsewhere.

Troubleshooting

mint: command not found: The npm install -g mint step didn’t install the CLI on the PATH used by the shell. Confirm your workflow uses actions/setup-node (or the equivalent) before installing, and that the install step runs in the same job as the check. Broken link check flags valid external URLs: External URL checks depend on the network reachability of the target site from the CI runner. Rate limits and firewalls can cause false positives. Only add --check-external if you accept occasional flaky runs, or run external checks on a schedule instead of on every pull request. Validation fails only in CI: Confirm the CI runner is checking out the same files you validated locally, including any generated OpenAPI files. If OpenAPI files are generated during the build, add that step to your workflow before running mint validate.