CI/CD Integration
Add rust-doctor to GitHub Actions, GitLab CI, and other CI/CD pipelines.
GitHub Actions
Add the official action to your workflow:
name: Code Health
on: [push, pull_request]
jobs:
rust-doctor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ArthurDEV44/rust-doctor@v1
with:
fail-on: warningThe action posts a PR comment with the health score, error/warning counts, and top diagnostics.
Options
| Input | Description | Default |
|---|---|---|
fail-on | Exit with failure on this severity (error or warning) | — |
diff | Scan only changed files vs base branch | false |
verbose | Include file:line details | false |
SARIF output
For GitHub Code Scanning integration:
- name: Run rust-doctor
run: npx -y rust-doctor@latest --sarif . > results.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarifGeneric CI
Use the --score flag for simple pass/fail:
SCORE=$(npx -y rust-doctor@latest --score .)
if [ "$SCORE" -lt 50 ]; then
echo "Health score too low: $SCORE/100"
exit 1
fiOr use --fail-on for severity-based gating:
npx -y rust-doctor@latest --fail-on error .Diff mode in CI
Scan only changed files on a PR to speed up CI feedback:
npx -y rust-doctor@latest --diff main --fail-on warning .