Noticed a couple basic functionalities from v1 are missing in the 2.0 pull request comment posting APIs, and they are currently undocumented so I was curious if there are workarounds or if support will be added to v2 before the sunset at the end of this month.
Here’s what the request body looks like using the 1.0 API:
POST /repositories/{accountname}/{repo_slug}/pullrequests/{pullrequestnumber}/comments
{
"username": "tutorials",
"pull_request_id": 672,
"comment_id": 14356,
"display_name": "tutorials",
"parent_id": null,
"deleted": false,
"utc_last_updated": "2012-08-12 20:04:38+00:00",
"filename_hash": null,
"base_rev": "174eecac678c",
"filename": null,
"content": "This is yet another comment",
"content_rendered": "<p>This is yet another comment</p>\n",
"user_avatar_url": "https://secure.gravatar.com/avatar/0bc5bd490000b8e63c35c0f54e667b9e?d=identicon&s=32",
"line_from": null,
"line_to": null,
"dest_rev": "101f16a95c13",
"utc_created_on": "2012-08-12 20:04:38+00:00",
"anchor": "a18fd07465b5",
"is_spam": false
}
And here are the issues I’m running into using the 2.0 API:
-
Using v2 it’s currently impossible to post a reply comment based on a parent comment’s ID (see
parent_id
in the request above). Therefore, you can never create a reply tree using the API, you can only keep adding top-level comments when posting to a specific line within a pull request. -
It’s also currently impossible to specify a commit sha when posting an inline comment (see
base_rev
,dest_rev
, andanchor
in the request above). You can only set a to/from line key, which I assume just selects either the base sha or current head sha, but this won’t function properly throughout the lifecycle of a pull request since the underlying code changes commit to commit.
These restrictions essentially render any application that is handling pull request interactions via the API useless, so I’m hopeful that either they will be added to 2.0 before deprecation, or the 1.0 APIs will continue to be maintained until this functionality is supported using 2.0. Any guidance here will prove helpful! Thanks.