Add comment to Github pull request from Jenkins pipeline

mitchellmaler picture mitchellmaler · Jan 14, 2018 · Viewed 10.1k times · Source

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.

Answer

VonC picture VonC · Jan 14, 2018

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..')