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.
Adding line comments to a pull requestUnder your repository name, click Pull requests. In the list of pull requests, click the pull request where you'd like to leave line comments. On the pull request, click Files changed. Hover over the line of code where you'd like to add a comment, and click the blue comment icon.
A pull request (PR) is a process when new code is reviewed before it should be merged to develop a branch or master branch in a Git repository like GitHub. The author creates a PR, while a reviewer reviews a PR. A PR could be time-consuming, annoying, or even nerve-racking if done wrong.
Configure your pipelineOn the Datalog Tagging tab, check “GitHub project”, and put your project URL in the field. On the Build Triggers tab, check “GitHub Pull Request Builder”. Then the GitHub API credentials is automatically filled in. Make sure the Admin list is filled in with at least one admin name.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With