温馨提示:本文翻译自stackoverflow.com,查看原文请点击:jenkins - How to setup web-hook using custom commit message?
jenkins jenkins-pipeline

jenkins - 如何使用自定义提交消息设置网络挂钩?

发布于 2020-04-16 13:55:32

我想使用自定义提交消息设置网络挂钩。当开发人员使用“继续迁移”提交消息提交文件时,我想触发Web挂钩。

我怎样才能做到这一点?

查看更多

提问者
Raghavendra
被浏览
106
salsinga 2020-02-04 21:39

以下代码对我有用,只需检查最新的git commit消息并有选择地构建您的工作即可:

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