Safeguard
Developer Tools•

Why scan the merged result, not just the pull request branch?

Two branches can each pass a scan and fail once combined. Scanning the merged result, via merge queues or merged results pipelines, closes that gap.

Safeguard Security Team
3 min read

Two branches can each pass a security scan and still fail once combined, because the target branch moved or the changes interact. Scanning the merged result, with a merge queue or a merged results pipeline, catches what a branch-only scan cannot.

The gap

A normal pull request scan checks the branch as the author left it. Meanwhile, the main branch keeps moving. By the time you merge, the code that lands is the combination of your branch and whatever has changed since you branched.

For security checks, the interaction can matter. Examples:

  • Your branch adds a package, and another merged change adds a different version of the same package.
  • Someone removes a version pin on main while your branch relies on it.
  • A policy file changes on main, and your branch now violates it.

Each branch looked fine alone. The merge produces something neither scan saw.

Two mechanisms

GitLab documents merged results pipelines, which run a pipeline that tests the result of merging the source and target branches together. GitHub lists a merge queue among its branch protection settings, and its workflow trigger list includes a merge_group event, which lets checks run for queued changes.

Both aim at the same goal: test what will actually land.

ApproachWhat it checksCost
Branch-only pull request scanThe author's branchLowest
Merged result scanBranch combined with targetHigher, more runs
Scan on the default branch after mergeThe shipped stateFinds problems late, no block

When it is worth the cost

Merged result scanning adds pipeline runs, which matters on busy repositories. Use it where the risk justifies it:

  1. Repositories that many people change daily.
  2. Services where a bad dependency state reaches production fast.
  3. Repositories with generated files or lockfiles that conflict often.

For low-activity repositories, a branch scan plus a default branch scan is usually enough.

Steps to adopt it

  1. Pick one busy, important repository as a pilot.
  2. Enable your platform's merged result or merge queue option.
  3. Make sure the scan job is configured to run for those events. Check the trigger names in the platform documentation, because a job that only listens to the plain pull request event will not run in the queue.
  4. Compare results for a few weeks, counting how often the merged scan failed when the branch scan passed.
  5. Expand if the number justifies the cost.

Keep the default branch scan anyway

Even with merged result checks, scan the default branch after each merge. It records the shipped state and feeds scheduled rescans, and it catches anything that slipped past through an admin bypass.

Where Safeguard fits

Safeguard's dependency scanning and policy gates can run wherever you place the job, including on the events your platform uses for merge queues. A free scan is at https://gold.safeguard.sh/scan.

Quick check

Is a merge queue the same as a merged results pipeline?

They share the aim of testing the combined result, but they are platform features with different mechanics. Check your platform documentation.

Does this slow merges?

It can add time per merge. Use it on busy, important repositories and keep fast checks first.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.