Skip to content

Commit

Permalink
chore: use listIssueComments for GitHub to list comments for a pull r…
Browse files Browse the repository at this point in the history
…equest
  • Loading branch information
prokopsimek committed Jan 14, 2020
1 parent cf75217 commit 70f4fa0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/git/GitHubService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,12 @@ export class GitHubService implements IVCSService {
prNumber: number,
options?: ListGetterOptions,
): Promise<Paginated<PullRequestComment>> {
const params: Octokit.PullsListCommentsParams = { owner, repo, pull_number: prNumber };
const params: Octokit.IssuesListCommentsParams = { owner, repo, issue_number: prNumber };
if (options?.pagination?.page) params.page = options.pagination.page;
if (options?.pagination?.perPage) params.per_page = options.pagination.perPage;

const { data } = await this.unwrap(this.client.pulls.listComments(params));
// use issues.listComments to list comments for a pull request
const { data } = await this.unwrap(this.client.issues.listComments(params));

const items = data.map((comment) => ({
user: { id: comment.user.id.toString(), login: comment.user.login, url: comment.user.url },
Expand Down

0 comments on commit 70f4fa0

Please sign in to comment.