Gate Pull Requests on a Drift Budget
Use vg scan --drift-budget to enforce a maximum DriftScore on pull requests. When a PR pushes drift over the limit the scan fails and a required status check blocks the merge.
A drift budget turns the DriftScore into a hard limit: if a pull request pushes drift past your agreed number, the scan fails and the PR is blocked. This is the cleanest way to stop upgrade debt from creeping in unnoticed.
Prerequisites
- The Vibgrate CLI already running in your CI pipeline.
- A DriftScore threshold your team agrees is acceptable.
- A protected branch where you can require status checks.
Steps
1. Pick a drift budget
Run a baseline scan locally to see your current DriftScore, then choose a budget at or slightly above it so existing code passes while new drift is caught.
vg scan
2. Run scan with --drift-budget
The --drift-budget flag sets the maximum allowed DriftScore. If the score exceeds the budget, the scan exits non-zero.
vg scan --drift-budget 60
A DriftScore at or below 60 passes; anything higher fails the command.
3. Wire it into the PR workflow
Add the budgeted scan to your pull request job so it runs on every PR.
- uses: actions/checkout@v4
- run: npx @vibgrate/cli scan --drift-budget 60
4. Make the check required
In your branch protection settings, mark the Vibgrate job as a required status check. Now a failing budget blocks merge.
5. Confirm the gate via exit code
Locally, run the command and inspect the exit code. A non-zero code is what CI uses to fail the job.
vg scan --drift-budget 60
Verification
Open a PR that adds drift past the budget; the Vibgrate check should turn red and block merge. A PR within budget keeps the check green. The exit code is the source of truth: 0 means within budget, non-zero means over.
Next Steps
- Combine with a committed baseline using
vg scan --baseline .vibgrate/baseline.jsonto gate on delta instead of absolute score. - Post the DriftScore as a PR comment for reviewers.
- Upload results to Vibgrate Cloud with
vg scan --pushto track the budget trend over time.
Prerequisites
- Vibgrate running in CI
- Agreement on an acceptable DriftScore
- A protected branch with required checks
Steps
- 1Pick a drift budget
- 2Run scan with --drift-budget
- 3Wire it into the PR workflow
- 4Make the check required
- 5Confirm the gate via exit code