Skip to content

Commit ca20592

Browse files
committed
update GitHubAPI.getPullRequestComments
1 parent 491bb0b commit ca20592

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

source/platforms/github/GitHubAPI.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,23 @@ export class GitHubAPI {
313313
return response.json()
314314
}
315315

316+
/**
317+
* Fetches all comments from a Pull Request on GitHub.
318+
*
319+
* This function retrieves all the comments associated with a given pull request.
320+
* It makes a request to the GitHub API endpoint that returns all comments for the
321+
* specified pull request and repository.
322+
*
323+
* https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#list-issue-comments-for-a-repository
324+
*
325+
* @returns {Promise<GitHubIssueComment[]>} A promise that resolves to an array of GitHub issue comments.
326+
*
327+
*/
316328
getPullRequestComments = async (): Promise<GitHubIssueComment[]> => {
329+
const pr = await this.getPullRequestInfo()
317330
const repo = this.repoMetadata.repoSlug
318-
const prID = this.repoMetadata.pullRequestID
319-
return await this.getAllOfResource(`repos/${repo}/issues/${prID}/comments`)
331+
const owner = pr.base.repo.owner.login
332+
return await this.getAllOfResource(`repos/${owner}/${repo}/issues/comments`)
320333
}
321334

322335
getPullRequestInlineComments = async (

0 commit comments

Comments
 (0)