Skip to content

Commit

Permalink
fix: use pagination api
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleytodd committed Mar 2, 2024
1 parent 5f04b02 commit e117aa5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit e117aa5

Please sign in to comment.