The GraphQL mutation for this is unusable, as it will always return the following error, no matter what.
{
"data": {
"__typename": "Mutation",
"addPullRequestReviewComment": null
},
"errors": [
{
"type": "VALIDATION",
"path": [
"addPullRequestReviewComment"
],
"locations": [
{
"line": 3,
"column": 3
}
],
"message": "Review has already been submitted."
}
]
}
Now, if we were to use the REST endpoint for the same, we get the following error,
{
"message": "Validation Failed",
"errors": [
{
"resource": "PullRequestReview",
"code": "custom",
"field": "user_id",
"message": "user_id can only have one pending review per pull request"
}
],
"documentation_url": "https://docs.github.com/rest/reference/pulls#create-a-reply-for-a-review-comment"
}
Why does this happen, and why are replies to other pull request reviews connected to your, unrelated, pending review? Only GitHub knows.
What I do know is that the website disables replies to other review comments if you have a pending review comment, as a hacky workaround for the bug.
On the other hand, the app does not, but if you try replying to a comment while having a pending review, the reply will also have the PENDING
notification on it for some reason, and will be included in the pending review when it is submitted, even if it was made in a completely different thread. If the pending review is cancelled, the replies made in other threads made via the app while it was active would also be deleted.
So, I have no choice to disable replies to review comments if a user has a pending review, just like the website.