DEVOPS

Block GitLab MR merge on bundle budget breach

On preview deploy, fails a GitLab commit status when the bundle delta exceeds the configured budget threshold, blocking merge until the regression is resolved.

CategoryDevOps
Enginesim
Difficultyintermediate
Triggerwebhook
Steps5
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerVercel preview deployment succeededVercelVercel
  • ActionSum client bundle bytesVercelVercel
  • ActionRead baseline and compute deltaGoogle BigQueryBigQuery
  • LogicBranch on budget threshold breach
  • OutputSet pass/fail GitLab commit statusGitLabGitLab

What it does

This workflow turns bundle budgets into a hard merge gate. After a Vercel preview build, it compares the new bundle size against the target-branch baseline in BigQuery. If the increase exceeds the configured threshold (absolute KB or percent), it sets a failed GitLab commit status on the MR head; if within budget, it sets a passing status. With the status marked required in GitLab, an over-budget MR cannot merge.

When to use it

Use it when warning comments are not enough and you need budget enforcement that actually stops a regression from shipping. Best paired with the baseline-recording workflow.

How it works

  1. 1Vercel `deployment.succeeded` webhook fires for a preview build.
  2. 2Sum the build's client bundle bytes via the Vercel API.
  3. 3Read the target-branch baseline from BigQuery and compute the delta.
  4. 4Branch: if delta exceeds the budget threshold, fail; otherwise pass.
  5. 5Set the corresponding pass/fail GitLab commit status on the MR head SHA.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect VercelDeploys, runtime logs, analytics.
  2. 2
    Connect BigQueryDatasets, queries, schemas.
  3. 3
    Connect GitLabRepos, MRs, pipelines, registry.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.