r-lib / gh

Minimalistic GitHub API client in R
https://gh.r-lib.org
Other
223 stars 52 forks source link

gh 1.4.0 gh_next() returns the same object #181

Closed carlosparadis closed 7 months ago

carlosparadis commented 1 year ago

I came across this issue when re-executing source code in a new machine and noticing my

while(!is.null(res){
    res <- gh::gh_next(res)
}

were returning the same page instead of the next page on the new machine, but not in the older machine.

Older machine:

New Machine (issue is here):

After re-installing on the New Machine gh 1.2.0, it worked again.

Minimal Reproducible Example on New Machine

require(devtools)
devtools::install_version("gh", version = "1.4.0", repos = "http://cran.us.r-project.org")
require(gh)

res <- gh::gh("GET /repos/{owner}/{repo}/issues/events",
              owner="Copilot-Language",
              repo="copilot",
              type="IssuesEvent",
              page=1,
              per_page=100,
              .token=token)

res[[1]]$id # 9297015929

res <- gh::gh_next(res)

res[[1]]$id # 9297015929

devtools::install_version("gh", version = "1.2.0", repos = "http://cran.us.r-project.org")
require(gh)

res <- gh::gh("GET /repos/{owner}/{repo}/issues/events",
              owner="Copilot-Language",
              repo="copilot",
              type="IssuesEvent",
              page=1,
              per_page=100,
              .token=token)

res[[1]]$id # 9297015929

res <- gh::gh_next(res)

res[[1]]$id # 8860246024

I did not get any errors or warnings when executing the MRE.

gaborcsardi commented 7 months ago
res <- gh::gh(
  "GET /repos/{owner}/{repo}/issues/events",
  owner = "Copilot-Language",
  repo = "copilot",
  type = "IssuesEvent",
  page = 1,
  per_page = 100
)

length(res)
res[[1]]$id

res2 <- gh::gh_next(res)
length(res2)

res2[[1]]$id

identical(res[[1]], res2[[1]])
carlosparadis commented 6 months ago

@gaborcsardi Thank you for addressing this!