I am wondering if there is already a way to update a Github (Enterprise) pull request with a comment within the Jenkins Pipeline syntax. I have it already updating it with the build status of success or failed automatically but I also want to post a comment with the test results and code coverage or the reason why the build failed. Before I start to write my own function in groovy calling the REST API of github to do this I wanted to make sure there wasn't already an easier way say like a plugin that had this function.
Asked
Active
Viewed 1.5k times
1 Answers
11
Check first if the "Adding a comment" section of the jenkinsci/pipeline-github-plugin would work for you:
def comment = pullRequest.comment('This PR is highly illogical..')
There are however issues associated with that approach (#85, #33)
Check however that you have the pipeline-github installed first.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
1Has anyone tried this approach? I encountered the error mentioned in this related question: https://stackoverflow.com/q/50488566/5362795 – Nagev Nov 27 '19 at 17:10
-
Does not work ! – Dominic Hofer Apr 08 '22 at 12:50
-
@DominicHofer Would the comment at https://stackoverflow.com/questions/50488566/add-a-comment-in-github-pull-request-in-jenkins#comment111502714_50516024 apply in your case? – VonC Apr 08 '22 at 13:24