DEVOPS

Tear down preview env when a GitLab MR merges or closes

Triggers on GitLab merge-request merge or close events and immediately deletes the matching Vercel preview deployment for that branch.

CategoryDevOps
Enginesim
Difficultyintermediate
Triggerevent
Steps5
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerGitLab MR merged or closedGitLabGitLab
  • LogicExtract branch and confirm terminal state
  • ActionFind Vercel preview for branchVercelVercel
  • ActionDelete matching preview environmentVercelVercel
  • OutputConfirm teardown in SlackSlack

What it does

This workflow ties preview-environment lifecycle directly to your GitLab merge requests. The instant an MR is merged or closed, it finds the Vercel preview deployment for that branch and tears it down, so finished or abandoned work stops consuming build and hosting budget.

When to use it

Use it when your team uses GitLab and wants preview environments cleaned up event-driven rather than on a daily sweep. It closes the gap between an MR being done and its preview being decommissioned, the window where stale previews quietly cost money.

How it works

  1. 1A GitLab webhook fires on merge-request merged or closed events.
  2. 2A logic step extracts the source branch name and confirms the event is a terminal state (merged or closed, not just updated).
  3. 3A Vercel action looks up preview deployments for that branch.
  4. 4A Vercel action deletes the matching preview environment.
  5. 5A Slack message confirms the teardown with the MR title, branch, and deployment removed.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect GitLabRepos, MRs, pipelines, registry.
  2. 2
    Connect VercelDeploys, runtime logs, analytics.
  3. 3
    Connect SlackChannels, DMs, threads, mentions.
  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.