Skip to main content

Gate Pull Requests on a Drift Budget

Use --drift-budget to fail a pull request build when the DriftScore exceeds an allowed ceiling. Learn how to choose a budget and tighten it over time.

Vibgrate Docs

Vibgrate Help

This recipe shows how to block pull requests whose upgrade drift exceeds a ceiling you set. It works on any CI provider and is for teams that want a single, easy-to-reason-about quality gate.

What a drift budget is

The DriftScore is a 0-100 measure of how far your project has drifted from current, supported versions. A drift budget is the maximum score you will accept. The CLI fails the run when the score exceeds it.

The gate

npx @vibgrate/cli scan --drift-budget 60

If the DriftScore is at or below 60, the scan exits zero and the PR build passes. If it is above 60, the scan exits non-zero and the build fails.

Post-install, the same gate is:

vg scan --drift-budget 60

Choosing a budget

Start by running a scan on your main branch to learn the current DriftScore, then set the budget at or slightly below that number. This ratchets quality: new PRs cannot make drift worse, and you can lower the budget as you pay down debt.

Comparing against a baseline

To gate on the delta from a stored baseline rather than an absolute score, create a baseline and pass it back in:

vg baseline
vg scan --baseline .vibgrate/baseline.json

See Drift Baselines & Fitness Functions for the full baseline workflow.

Making it enforce merges

A failing build only blocks a merge if the build is a required status check. See Required status checks for drift gates.

Related

  • Fail builds on a severity threshold with --fail-on.
  • Comment Vibgrate results on pull requests for inline context.

Related Commands