2017-09-23 65 views
1

我使用組織插件來構建我的github項目的pullRequest。 在此構建過程中,我想發送一個自定義註釋,其中包含項目的某個度量標準,並將其傳遞給github pullRequest。如何發送評論在jitkins/jenkinsfile github pullRequest

我該怎麼辦?

+0

執行一些腳本,調用API GitHub的。我不知道任何Jenkins插件爲此提供了一個管道步驟(這將是超級棒的)。 – StephenKing

+0

或直接通過管道groovy代碼調用它... – StephenKing

+0

@StephenKing 如果有人找到插件的名稱,或者給我一小段代碼,我會數 - 它作爲一個答案 – sab

回答

0

沒關係,我發現:(需要安裝HTTP請求插件)

 def SHA1 = sh(returnStdout: true, script: "git rev-parse HEAD").trim() 
     def body="""{ 
       "body": "Nice change", 
       "commit_id": "$SHA1", 
       "path": "/", 
       "position": 0 
      }""" 


     httpRequest authentication: '${yourCredential}', httpMode: 'POST', requestBody: body, url: 'https://api.github.com/repos/${yourOrga}/${yourRepo}/issues/${pullRequestNumber}/comments'