CI quality gate
Combine check, coverage, and lint into a single job to fail PRs that degrade documentation.
Example job
.github/workflows/docs-quality.yml
# .github/workflows/docs-quality.yml
name: Docs quality gate
on: pull_request
jobs:
docs-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Docs quality gate
run: |
npx nestjs-docfy check
npx nestjs-docfy coverage --min 90
npx nestjs-docfy lintcheck fails if any controller marked with @WithDocs() has no companion file or has methods added since the last generate. coverage --min 90 fails the build if fewer than 90% of endpoints are documented. lint judges the quality of what's already documented: missing summary on ApiOperation, endpoints with @Body() and no 400 response, and ApiBody without a description. Any of the three commands exits with code 1 when it finds problems, which fails the pipeline.
What failure looks like
npx nestjs-docfy check
✖ UsersController: undocumented methods: updateProfile, deleteAccount
→ run nestjs-docfy generate --force to merge new methods
✖ 2 controller(s) out of sync.npx nestjs-docfy coverage --min 90
Controllers: 42
Endpoints: 187
Documented: 174
Missing docs: 13
Coverage: 93.0%npx nestjs-docfy lint
✖ POST /users
Missing 400 response
✖ GET /users
Missing operation summary
✖ PATCH /users/:id
Missing request body description
✖ 3 issue(s) found.As npm scripts
package.json
{
"scripts": {
"docs:check": "nestjs-docfy check",
"docs:coverage": "nestjs-docfy coverage --min 90",
"docs:lint": "nestjs-docfy lint"
}
}