Cancel preview build for a branch when a new build is started

Our team uses Vercel Preview in our CI pipeline as a smoke test before merging code into main to make sure that the code builds successfully. The current issue for our team is that devs frequently publish a new PR, realize they need to make additional changes, and then push new changes into the PR shortly after. This triggers 2 preview build processes for the same PR

However, with the way we use our preview as a smoke test, we only need the latest build to succeed since any previous builds don’t reflect the current state of the PR. We do realize that devs can manually cancel previous builds, but this doesn’t easily scale with team size as it requires consistent human behavior/habits/reinforcement

Does Vercel offer any simple way to automatically cancel previous builds for a branch when a new build is triggered on that same branch?

Hi, @jamisonsavvywealth! Welcome to the Vercel Community :smile:

Vercel automatically cancels previous builds when a new commit is pushed to the same Pull Request branch. This feature:

  1. Ensures the latest code is always tested
  2. Reduces resource usage
  3. Provides quicker access to recent changes

Additionally, Vercel uses per-branch caching to speed up builds.

For more details, you can refer to Vercel’s official documentation on deployment workflows.

Let us know if you have any more questions!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.