3

Goal

I want to use the GraphQL API to reply to a pull request review comment.

It is possible if the status of the review is PENDING, but when the status of the review is SUBMITTED, it is not possible. When I try it over the UI or the API V3 (REST), everything works fine.

This is an example of an reply to another PR-review comment.

This was the way to do it over the REST API.

What I have tried

I have tried to use the GraphQL addPullRequestReviewComment mutation.

Here is my mutation request

mutation {
  addPullRequestReviewComment(
    input: {
      pullRequestReviewId: $pullRequestReviewId, 
      inReplyTo: $commentToReplyTo, 
      body: "test comment"
    }) {
        clientMutationId
        comment{
          body
     }
  }
}

I expect the above mutation to reply to another review comment, but I get this response:

{
  "data": {
    "addPullRequestReviewComment": null
  },
  "errors": [
    {
      "type": "VALIDATION",
      "path": [
        "addPullRequestReviewComment"
      ],
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "message": "Review has already been submitted."
    }
  ]
}

I know that when you reply to another PR-Review comment of an already submitted review, you create a new review object for that comment.

But when I would try to solve my problem with that logic I would expect to find a reply_to field or some other way to link to a comment of another PR-review comment on the addPullRequestReviewInput object.

dellum
  • 31
  • 2
  • Did you ever find a solution for this? I'm running into the same problem... – brianc Jan 29 '21 at 17:21
  • Yep, the problem is that GraphQL api submits "pending" comment, like this https://p408.p1.n0.cdn.getcloudapp.com/items/04u5GRZg/2f0571fb-038d-462e-9c98-5c5e8dd5a692.jpg?v=1c6a74ced8bf28957ee0a529417f87f9 It requires a second call to "submit review" – Restuta Oct 10 '21 at 05:08

0 Answers0