I want to setup Jenkins pipeline trigger when PR is merged to master
branch. I have setup Webhook in GitHub repo pointing to Jenkins url http://jenkins.example.com:8080/github-webhook/
and selected following events
- Pull request review comments
- Pull request reviews
- Pull requests
in my Jenkinsfile I use this
triggers {
pullRequestReview(reviewStates: ['approved'])
}
But it failed with this error
WorkflowScript: 6: Invalid trigger type "pullRequestReview". Valid trigger types: [upstream, cron, parameterizedCron, GenericTrigger, githubPush, pollSCM] @ line 6, column 9.
If I want to trigger the build when PR is merged to master, what I should user in triggers
?
Here is what you need:
And you don't need to select Pull request review comments and Pull request reviews events. Just Pull requests is enough for this case.