Search code examples
jenkinsgithubgit-webhooks

How to set up github webhook trigger on pushing in certain branch


I have Jenkins pipeline, and configured github webhook to trigger pipeline.

How to make triggering pipeline when the certain branch was pushed, instead of triggering pipeline by pushing to every branch ?


Solution

  • Webhook is generic for all, there is no filter on the side github or bitbucket, all you need to handle based on payload.

    you can use Generic+Webhook+Trigger+Plugin,The plugin will allow you to parse certain data from the payload, and can conditionally trigger a build depending on the branch name.

    Apply the filter with branch name

    enter image description here

    generic-webhook-trigger-plugin-specific-branch