Run docsbot in CI
docsbot is a single binary with meaningful exit codes, so it runs in any CI system. The repository also ships a GitHub Action.
| Exit code | Meaning |
|---|---|
0 |
success: no findings at or above the threshold |
1 |
findings over the threshold (--fail-level, --fail-under, gaps, or a blocked draft) |
2 |
bad input or a failure |
GitHub Actions
The action installs docsbot and runs one command.
# .github/workflows/docs.yml
name: docs
on: pull_request
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: kakabisht/Docs-toolkit@main
with:
command: check docs --changed-only --base origin/${{ github.base_ref }} -f github
fetch-depth: 0 fetches the base branch, which --changed-only needs to diff against.
With -f github, findings appear as annotations on the changed lines.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
command |
yes | docsbot command and arguments, without docsbot |
|
version |
no | latest |
docsbot version to install: a module version such as v0.1.0, or latest |
node |
no | "false" |
"true" sets up Node 22, needed by agent-ready check |
working-directory |
no | . |
folder to run the command in |
Pin version (for example v0.1.0) for reproducible builds. The command is split on
spaces, so quote nothing inside it.
Upload SARIF to code scanning
- uses: kakabisht/Docs-toolkit@main
continue-on-error: true
with:
command: check docs -f sarif -o docsbot.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: docsbot.sarif
Gate on agent readiness
- uses: kakabisht/Docs-toolkit@main
with:
node: "true"
command: agent-ready check docs --site https://docs.example.com --fail-under 70
Find undocumented flags on a branch
- uses: kakabisht/Docs-toolkit@main
with:
command: agent gaps --since origin/${{ github.base_ref }}
Other CI systems
Install with Go, or download a binary from the releases page, then run docsbot:
go install github.com/kakabisht/Docs-toolkit/cmd/docsbot@v0.1.0
docsbot check docs -f junit -o docsbot-junit.xml
Use -f junit for systems that show test reports (GitLab, Jenkins, CircleCI) and -q to
keep progress messages out of the log.