Triggering Netlify from a specific GitHub branch


I am triggering my Netlify build from pushes to a GitHub repository that is different than the one that the site is build off. GitHub does not support triggering webhooks for a specific branch, so currently it’s pushing notifications to Netlify on every branch. I’d love to find a way to limit these builds to only the ones for a specific build. Is there a way we can achieve this?

Feature requests - what do you already love, what could be better?

Hey cbetta

You could setup a netlify function as your webhook endpoint.

In that function, you can check the github webhook payload and verify the branch is the correct one and then ping the netlify build URL if it matches.

Here is a function example that is triggering builds from dropbox

You can alter that code to instead receive the github webhook post. In your github webhook setting you would point to the netlify function URL (something like


1 Like
Gatsby/Github cache issue when fetching remote sources

I actually ended up doing this before you mentioned this and it indeed works! Thanks for the tip.

I do feel that, although it’s a solution, it’s also costing me function calls I’d rather use for production features. I’d love to see a solution for this come to the platform some time.


hey there, if you haven’t already, this might be a great thing to write up in this thread on features you’d love to see.