Skip to content

Commit 1f3a415

Browse files
bjohansebasctcpip
andcommitted
fix fetching pull request
Signed-off-by: Sebastian Beltran <[email protected]> Co-authored-by: ctcpip <[email protected]>
1 parent 8425d65 commit 1f3a415

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/agenda.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ async function fetchAgendaItems (client, repos, agendaLabel) {
3030
console.log(`Adding Issue: ${i.url}`)
3131
agendaIssues.push(i)
3232
}
33+
34+
const _agendaPrs = (await client.paginate('GET /repos/{owner}/{repo}/pulls', {
35+
owner: r.owner,
36+
repo: r.repo,
37+
state: 'open',
38+
labels: agendaLabel,
39+
per_page: 100
40+
})).filter(pr => pr.labels.find(label => label.name === agendaLabel) &&
41+
!agendaIssues.find((i) => i.url === pr.url)) // workaround for flaky GH API/SDK behavior where sometimes the issue endpoint loads PRs
42+
43+
console.log(`Fetching PRs for ${r.owner}/${r.repo}: Found ${_agendaPrs.length}`)
44+
45+
for (const pr of _agendaPrs) {
46+
console.log(`Adding PR: ${pr.url}`)
47+
agendaIssues.push(pr)
48+
}
3349
}
3450

3551
console.log(`Found ${agendaIssues.length} total issues for agenda`)

0 commit comments

Comments
 (0)