Is there a way I can post a comment on a Github Pull Request via the command line? The ideas is that I want Jenkins to post comments on Pull Requests with a summary of the results of a script.
Post a comment on Github Pull Request via Command Line
4.3k views Asked by Ebrahim Moshaya At
3
There are 3 answers
0
On
This is absolutely possible with nothing more than curl.
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/octocat/hello-world/issues/42/comments \
-d '{"body":"Hello Github!"}'
Read more about the API in use here https://docs.github.com/en/rest/reference/issues#create-an-issue-comment
NOTE: This assumes you have a Personal Access Token stored in an environment variable named GITHUB_TOKEN
0
On
This is a little late, but this sounds like exactly what you are looking for:
gh pr comment 6 --body "Hi from GitHub CLI"
https://cli.github.com/manual/gh_pr_comment
Simply allows you to add comments to a pr from a given pr number.
It's not possible without third party extensions.
You may be intrested in this: https://github.com/stephencelis/ghi
Sorry I can't help more!