如何在Jenkins中找到GitHub PR的打开者(通过CLI)?

问题描述 投票:0回答:1

我想知道,是谁(姓名、用户、邮箱)在我的Jenkins-Pipeline中打开了GitHub的拉取请求,我看到,已经有一个插件(https:/github.comjenkinscighprb-plugin。),但我不确定它是否提供了这些信息。那么有没有一种方法可以获得这些信息,比如通过git-cli?或者你是怎么做的?

谢谢你的帮助

git jenkins github jenkins-pipeline pull-request
1个回答
0
投票

用Git CLI是不可能的,因为拉请求是Github的功能,不是Git的功能。

有两个选择。

1)使用Github API。https:/developer.github.comv3pulls#get-a-single-pull-request(拉请求)

2) 使用名为 Hub,就像这样。

hub pr show {PR-NUMBER-GOES-HERE} -f "%au"  

请看这里的文档。https:/hub.github.comhub-pr.1.html。


0
投票

Pipeline GitHub插件 给你一个全球性的 pullRequest 你可以检查的对象。

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                if (env.CHANGE_ID) { // otherwise the object is not defined
                    println pullRequest.createdBy()
                }
            }
        }
    }

}
© www.soinside.com 2019 - 2024. All rights reserved.