Reputation: 228
I am trying to retrieve list of comments for particular Pull Request using go-github. I am interested in comments listed in the section Conversation not the review comments.
I tried to use PullRequests.ListComments, but it returns review comments
PullRequests.ListComments(ctx, ghOrgName, ghRepoName, *value.PullRequest.Number, &github.PullRequestListCommentsOptions{})
I didnt find suitable function in the documentation
Thanks in advance
Upvotes: 2
Views: 223
Reputation: 4750
Might be a little late to answer this, you will need to use the issues endpoint https://docs.github.com/en/rest/guides/working-with-comments?apiVersion=2022-11-28#pull-request-comments
so, the code will look something like this
comments, _, err := client.Issues.ListComments(ctx, "ghOrgName", "ghRepoName", prNumber, &github.IssueListCommentsOptions{})
if err != nil {
return err
}
for _, comment := range comments {
fmt.Println(*comment.Body)
}
Upvotes: 0