I am trying to generate a webhook from Github to trigger a build whenever a feature branch gets merged to the specific branch (e.g. master). I am using the "Generic Webhook Trigger" plugin in Jenkins to do this since couldn't find any other suitable plugins.
And I found I could refer to two variables in the payload.
payload.ref== "refs/head/master"payload.commits[1].messagematchesMerge pull request*
However, in the plugin, it seems that I could set only one filter. Is there any way to set multiple filters?
I solved it by using the
regexpFilterExpression.First you will need to put the branch name for which the push event came for into a variable named
refby adding this to theGenericTriggerclass:Now we need all the titles from the commits that were in the trigger payload, so add another variable for it
Then we need to assemble the string on which the filter will be applied on by defining the
regexpFilterTextproperty inGenericTriggerclassVariables will be substituted.
Then it is time to define the actual filter
Complete example: