Warm tip: This article is reproduced from stackoverflow.com, please click
jenkins jenkins-pipeline

How to setup web-hook using custom commit message?

发布于 2020-04-16 12:00:49

I want to set up a web-hook using custom commit message. I want to trigger web hook when developer commit files with 'Proceed with Migration' Commit message.

How can I do this?

Questioner
Raghavendra
Viewed
60
salsinga 2020-02-04 21:39

The following code worked for me, simply check the latest git commit message and selectively build your job:

def resultlog = sh(returnStdout: true, script: 'git log  -1 --pretty=%B')
    if (resultlog.contains("Proceed with Migration")) {
    //your code
    }