You can change the publish branch in your build and deploy settings to something that you would never use, like “this-will-never-deploy”. Or if you are on gitlab or bitbucket you can remove the build webhooks from the repo.
That was what i did in the first place. Setting ‘Production branch’ to something which does not exist.
But if a build gets triggered via a webhook(which will trigger a build for master) you can’t see it back in the ‘production deploys’ overview… Because the ‘production deploys’ overview shows an overview about the branch which does not exist…
there is already a feature to do that - if you include [skip ci] in your commit message, we won’t build. I understand that you probably don’t want to prefix all your commit messages with that, but it is possible.
I don’t think we have plans to change the “how you specify what we build” setup in other ways anytime soon, but we do have an open feature request to allow badges for other branches to which I’ve added this thread for followup in case we ship it.
In the meantime there are some other potential workarounds for you:
locked deploys - we still build everything, but never autopublish it: Manage deploys | Netlify Docs . This is what we use to disable autopublishing e.g. before a major release. You can publish an existing deploy via our API
give your build script some other smart logic to check if this one is an intended build and build it only in case it matches some pattern (e.g. only build merge requests)
try filtering the webhooks sent to netlify using a service like zapier (“oh, that’s a PR that says WIP in its commit message; don’t forward this one to Netlify!”)
@lkniep But surely if you’ve changed the production branch to a non existent branch, then the webhook will attempt to trigger the non existent branch (instead of master) and then fail? Or am I misunderstanding something?
I was trying to only build/deploy by adding the build hook to my pipeline. Adding it to the pipeline as is resulted in double builds (triggered by push AND pipeline). Renaming the production branch with a bogus name didn’t work for me because I wanted it to automatically publish on my actual main branch. I ended up…
Creating a build hook and leaving my production branch name the same
Disabling the webhook in my repo (automatically added by Netlify)
Curious if anyone has some idea of contrasting this idea of setting the publish branch to some bogus branch name vs unlinking github from the site. Just curious of the pros/cons.
I am looking for the best way to continue with manual builds via CLI and CI/CD, while having the abiility to lock the production build to a particular deploy, and publish newer or revert to older deploys via the deploys page UI when needed. Currently we have builds turned off, so we cannot manually publish a deploy via the UI.
Adding one more possibility to the mix here: a currently undocumented behavior of our ignore command is that it won’t run for builds triggered by webhook… but it will run for builds triggered by a push to Github. So if your netlify.toml is:
ignore = "exit 0"
this will cancel all builds triggered via Github push. But webhook builds will succeed.