This recipe explains how to make a Vibgrate drift scan a required status check, so a failing scan actually blocks a merge instead of just showing red. It is for repository administrators across any provider with branch protection.
The two halves
A gate has two parts: a scan that exits non-zero when drift is too high, and a branch-protection rule that requires that scan's check to pass.
The scan half
Run a scan that fails on regressions in your PR pipeline:
npx @vibgrate/cli scan --drift-budget 60
Or gate on severity:
npx @vibgrate/cli scan --fail-on error
Either way, a non-zero exit code marks the CI job as failed, which publishes a failed status check for the commit.
The branch-protection half
In your provider's branch protection settings for the target branch, mark the CI job that runs the scan as a required status check. Once required, pull requests cannot merge until that job is green. Use a stable, unchanging job name so the requirement keeps matching across runs.
Keeping checks reliable
Required checks should be deterministic. Pin the scan to a numeric budget rather than relying on incidental output, and run the same command on every PR. See Gate pull requests on a drift budget for choosing the number.
Related
- Fail builds on a severity threshold with
--fail-on. - Comment Vibgrate results on pull requests for reviewer context.