GitHub Actions
The Drako GitHub Action posts inline PR review comments on the exact lines where issues are found, uploads SARIF to GitHub Code Scanning, and gates merges on governance score..github/workflows/drako.yml
Exit code behavior
--fail-on controls which severity level causes a non-zero exit:
| Flag | Exits non-zero when… |
|---|---|
--fail-on critical | Any critical finding is present |
--fail-on high | Any high or critical finding is present |
--fail-on medium | Any medium, high, or critical finding is present |
--fail-on low | Any finding at any severity is present |
0 and the job passes.
Determinism score threshold
--threshold-det N fails the job if the determinism score drops below N. Scores run from 0 to 100. For example, --threshold-det 60 enforces a minimum determinism grade.
SARIF upload and inline PR comments
The--format sarif flag outputs results in the SARIF 2.1.0 format. Uploading that file to GitHub Code Scanning via github/codeql-action/upload-sarif gives you:
- Inline annotations on the exact lines with findings, visible directly in pull request diffs
- A Security tab summary with finding counts by severity
- Persistent finding tracking across commits
if: always() condition ensures the SARIF file is uploaded even when the scan step fails, so findings are visible for failing PRs.
Pre-commit hook
Run a governance scan before every commit using pre-commit:.pre-commit-config.yaml
drako scan . --fail-on critical and blocks the commit if any critical findings are present. It always runs regardless of which files were staged (always_run: true) and uses the system Python environment with drako as a dependency.
Baseline: acknowledge existing issues
Existing projects often accumulate 40+ findings on first scan. The baseline lets teams acknowledge the current state so CI only fails on new issues introduced by a PR.Save the baseline
Run the baseline command once in your main branch. This creates
.drako/.baseline.json in your project directory.Commit the baseline file
Commit
.drako/.baseline.json to the repository. It is shared across the team.The governance score always reflects all findings — the baseline only affects pass/fail for CI. When you view
drako scan output, the score represents your real posture.In SARIF output, baselined findings appear with "baselineState": "unchanged" so GitHub Code Scanning can distinguish them from new issues.