github
github copied to clipboard
listPullRequests({ state: 'all' }) does not return all pull requests.
Reproduction
const assert = require('assert')
const Github = require('github-api')
const github = new Github()
;(async () => {
const repo = github.getRepo('vuejs', 'rfcs')
const all = (await repo.listPullRequests({ state: 'all' })).data.length
const open = (await repo.listPullRequests({ state: 'open' })).data.length
const closed = (await repo.listPullRequests({ state: 'closed' })).data.length
assert.equal(all, open + closed)
})()
See
https://github.com/vuejs/rfcs/pulls
Ah. It's relating to all these pagination issues.
Workaround
const all = await repo._requestAllPages(
`/repos/${repo.__fullname}/pulls?state=all`,
)
Is this related to pagination? This just seems like an options-passing issue.
I don't know.
But I found the _requestAllPages workaround in another issue relating to pagination.
So presumed it was that.