How to use Netlify only for Pull Request previews

Hello everyone,

I want to setup Netlify in order to build previews of my documentation on GitHub once someone creates a Pull Request.
I, however, don’t want Netlify to build pages in any other case, as I have a separate system set up for this (i.e. push site to the gh-pages branch once I commit changes to master branch).
Is there a way to configure Netlify to ignore specific branches or to straight up set it to only start deploying on Pull Requests?

you can’t do exactly that, no. We’ll only build pull requests that target the list of branches shown in

I’d recommend using the build.ignore script as discussed in this thread, to prevent non-PR builds from firing: [Support Guide] How can I optimize my Netlify build time? - #10 by marcus

When you get that script dialed in, the build will still start, but it will exit before any substantial build time is used.

There are other workarounds for this - things like “not sending non-PR events from GitHub”, or “send through a system like Zapier that can filter which notifications it passes on to Netlify” but those are rather more complicated to configure, so I suggest trying my suggestion first.