From e117aa5df45d95cd70fca6a16f6eb6a3a7d4679c Mon Sep 17 00:00:00 2001 From: Wes Todd Date: Sat, 2 Mar 2024 10:54:22 -0600 Subject: [PATCH] fix: use pagination api --- run.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/run.js b/run.js index 1e88e68..08a7277 100644 --- a/run.js +++ b/run.js @@ -52,8 +52,8 @@ const conversions = require('./lib/conversions') orgs = orgs.split(',').map((o) => o.trim()) for (const org of orgs) { console.log(`Fetching repos for ${org}`) - const resp = await client.repos.listForOrg({ org }) - resp.data.forEach((r) => { + const resp = await client.paginate('GET /orgs/{org}/repos', { org }) + resp.forEach((r) => { repos.push({ owner: org, repo: r.name @@ -92,12 +92,13 @@ const conversions = require('./lib/conversions') let agendaIssues = [] for (const r of repos) { console.log(`Fetching issues for ${r.owner}/${r.repo}`) - const _agendaIssues = (await client.issues.listForRepo({ + const _agendaIssues = await client.paginate('GET /repos/{owner}/{repo}/pulls', { owner: r.owner, repo: r.repo, state: 'open', labels: agendaLabel - })).data || [] + }) + console.log(_agendaIssues) agendaIssues = agendaIssues.concat(_agendaIssues) } const opts = {