I use Vercel to deploy a Next.js app and I use Vercel for GitHub for CI/CD. Vercel automatically deploys code pushed to my master
branch to production, and I would like to keep this functionality. However, Vercel also creates preview deployments for each push, and when I create a pull request, this deployment shows up under 'Checks.' Is there a way to stop this from happening? I don't have an issue with Vercel creating a preview deployment for each push I make, but I would like for Vercel's deployment not to appear under the 'Checks' section of each pull request.

- 177
- 1
- 2
- 9
3 Answers
Adding the following command in the ignored build step box of /settings/git
page of your project to disable running the builds for non-production environments. Effectively disabling deploy previews
[ "$VERCEL_ENV" != production ]

- 6,828
- 3
- 35
- 47
You can use the "Ignore Build Step": https://vercel.com/support/articles/how-do-i-use-the-ignored-build-step-field-on-vercel
You can tell Vercel only to build master
(or main
depending on your git
configuration), and all other branches will be ignored.
EDIT: Thanks to @Dani Akash for the suggestion below

- 1,572
- 14
- 20
-
3The second comment on this page shows exactly how to do this. – Manav Bokinala Jul 05 '21 at 05:38
-
1Agree. The second comment is super helpful. Perhaps @paulogdm could update the article with example implementations including the `[ "$VERCEL_ENV" != production ]` solution. Yes? – noctufaber May 09 '22 at 19:27
-
1Absolutely! Doing now. Amazing addition indeed. – paulogdm May 09 '22 at 19:59
Additionally, if you have also have a staging branch and you want builds to be run for both main and staging you can you the following command:
[[ "$VERCEL_GIT_COMMIT_REF" != "staging" && "$VERCEL_GIT_COMMIT_REF" != "main" ]]
You can also use a add ignored build step script in the root of your project. You can read more about it here: https://vercel.com/guides/how-do-i-use-the-ignored-build-step-field-on-vercel

- 238
- 4
- 8