Is it possible to have some control over which branches get a deploy preview?

We’ve recently started using renovate for automated package updates, and have deploy previews on for all PR’s (which we’ve started to love and now heavily lean on in our review process). Most of our Netlify build time is now used up by renovate branches/pull requests and we’d like to have more control over which branches are eligible for deploy previews.

Is it possible to deploy only certain branch names using an include/exclude pattern so we can fine-tune which branches/PR’s will get a deploy preview?

This is becoming especially important for us since the introduction of the new pricing model.

Despite some searching in the docs and this community I wasn’t able to find a clear answer.

Yes, It’s available in the Deploy tab of your netlify dashboard. It’s under Domain management > Branch Subdomains. There, you can select what braches are deployed. This is only possible if you rely on netlify DNS.

Thanks @Siteme for your answer.

If I understand the branch subdomains feature correctly (we don’t have Netlify DNS, so IU can’t test it out, had to read the docs on this), this won’t help us solve the problem.

Let me try to clarify our scenario and what we’d like to achieve:

We currently have a lot of branches and respective pull requests created on GitHub by a service called Renovate. It basically creates a new branch every time there’s an update in one of our dependencies available (which is often). We’d like to run our full test-suite on these branches (running on CI separate from Netlify) but don’t need the Netlify deploys.

What we’re looking for is a feature which would allow us to filter out (i.e. not run deploy previews builds) PR’s for branches matching a particular pattern (in our case e.g. renovate/*).

So I hope I got this right, you’re looking for something like All but [these] instead of the usual offered All, None, Only [these]. Is that correct?

Most useful for our use case if we could filter branches by pattern, whether that would be include [pattern] or exclude [pattern] doesn’t really matter for us (assuming negative lookahead is supported).

Hiya @hongaar, I wanted to point you to this thread requesting a feature that I believe is what you’re asking about:

Can you take a look and let me know if that’s what you’re describing/looking for? If so, I would be happy to add your vote to that request internally. And if not, let me know so we can dig in further!

Hi @jen, here’s a long overdue reply.

The feature request you mention is specifically for Branch deploys (I think). While that’d also be a welcome feature, my request originates from our need to filter out specific branches from Deploy previews.

In the web interface, those two types of deployments seem to be distinct in their configuration. Maybe internally they are interconnected however, I don’t know.

Deploy previews are built from PR’s, branch subdomains are only deploys on a branch (so - the code from which you make a PR, or what happens when you merge to PR).

Regardless, better filtering/selection of git branches is the open feature request there which will impact all of the above :slight_smile: We’ll follow up in that thread if we come up with a productized version of this, but for now, you could try using the ignore script documented here to implement your own finer grained control - build would still start but you could abort it before it uses up any build minutes:

1 Like

Thanks @fool, that’s actually a pretty useful feature for achieving this I didn’t know existed.