alphanumeric
alphanumeric

Reputation: 19329

How to get Pull Request Message Body

With git log command I can successfully get a Github Pull Request number. Now, with the Pull Request number known, I would like to go ahead and query the message (a comment) posted with the PR (the PR message is displayed under the Conversation tab). Here is an example of PR with a message posted:

enter image description here

https://github.com/podgorskiy/ALAE/pull/11

How to query the PR message (aka PR comment) from a command line (with curl or git or something else)?

Upvotes: 1

Views: 4286

Answers (1)

Saurabh P Bhandari
Saurabh P Bhandari

Reputation: 6742

To get the PR message using curl

curl https://api.github.com/repos/:owner/:repo/pulls/:pull_number | jq '.body'

To get the PR comments using curl use Issue Comments API as per the docs :

The Pull Request API allows you to list, view, edit, create, and even merge pull requests. Comments on pull requests can be managed via the Issue Comments API.

curl https://api.github.com/repos/:owner/:repo/issues/:pull_number/comments | jq '. [] | .body'

Note: You can process the JSON data received from the curl request using jq, a command-line JSON processor.

Upvotes: 5

Related Questions