Search code examples
githubjenkinspull-requestmultibranch-pipeline

Triggering Jenkins Multibranch Pipeline automatically if a PR is raised on GitHub


I am using Jenkins Multibranch pipeline. I've configured the APIs (github-webhook and ghprbhook) on GitHub. Currently, If I click on "Scan Repository Now/Scan Repository Log" in Jenkins, the Jenkins will go through the GitHub and creates a new PR job in Jenkins if there are any PR on GitHub. So I need to trigger this Multibranch pipeline whenever there is a Pull Request raised on GitHub. I want this pipeline to trigger automatically when there is a PR on GitHub. What do I need to do to achieve this approach? Is it possible to trigger Multibranch pipeline automatically whenever a PR is raised on GitHub?


Solution

  • To achieve this, I have selected only "Push and Pull Request" under "Let me select individual events" section of GitHub Webhooks.

    PS: The GitHub branches are automatically detected in Jenkins.