github-tools / github

A higher-level wrapper around the Github API. Intended for the browser.
BSD 3-Clause "New" or "Revised" License
3.6k stars 755 forks source link

listPullRequests({ state: 'all' }) does not return all pull requests. #593

Open sustained opened 4 years ago

sustained commented 4 years ago

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

sustained commented 4 years ago

Ah. It's relating to all these pagination issues.

Workaround

  const all = await repo._requestAllPages(
    `/repos/${repo.__fullname}/pulls?state=all`,
  )
j-rewerts commented 4 years ago

Is this related to pagination? This just seems like an options-passing issue.

sustained commented 4 years ago

I don't know.

But I found the _requestAllPages workaround in another issue relating to pagination.

So presumed it was that.