Published February 08, 2019 by

Configure GitHub Webhook in Jenkins Job

In this tutorial, we will learn how to Jenkins automatically create a build if it detects changes to a GitHub repository.

GitHub webhooks feature in Jenkins is used to trigger the build whenever a developer commits something to the master branch.

Plugin installation

1. Login to Jenkins and navigate to Manage Jenkins > Manage Plugins

2. Install a Github Plugin.

Create webhook in the Github repository

1. Go to your project repository.
2. Go to settings in the right corner.
3. Click on Webhooks
4. Click Add webhooks
5. Write the Payload URL as 'http://JENKINS_URL/github-webhook/'
6. Click on Add webhook

Now you can see webhook is successfully added.

Configure webhook in the Jenkins Job/Pipeline

Go to the Jenkins pipeline and select 'GitHub hook trigger for GITScm polling' in Build Triggers Section

Now it's done. from onwards whenever developers commit code to GitHub repository, our Jenkins job build will be automatically triggered.