diff --git a/src/githubApi.ts b/src/githubApi.ts index 4b67467..a24440e 100644 --- a/src/githubApi.ts +++ b/src/githubApi.ts @@ -6,11 +6,12 @@ export const getPullRequestWithReviews = async (octokitInstance: github.GitHubIn const prs = await github.getPullRequests({ state: "open", ...repo }, { octokitInstance }); debug(`Found a total of ${prs.length} PRs`); - const reviews = await Promise.all(prs.map(async (pr) => { + let reviews: PullRequest[] = []; + for (const pr of prs) { debug(`Fetching reviews for PR #${pr.number}`); const { data } = await octokitInstance.rest.pulls.listReviews({ pull_number: pr.number, ...repo }); - return { ...pr, reviews: data }; - })) + reviews.push({ ...pr, reviews: data }); + } const sortedPrs = reviews.sort((a, b) => { return b.updated_at > a.updated_at ? -1 : b.updated_at < a.updated_at ? 1 : 0 }); return sortedPrs;