rstudio / packrat

Packrat is a dependency management system for R
http://rstudio.github.io/packrat/
401 stars 89 forks source link

stop using devtools::github_pat, as it is no longer available #649

Closed aronatkins closed 2 years ago

aronatkins commented 2 years ago

We have started seeing errors when folks are using packrat to install private GitHub packages. This is rooted in the fact that devtools has removed the github_pat function in its 2.4.3 release.

R errors such as the lack of devtools::github_pat would now appear like:

Error in value[[3L]](cond) : Failed to download package from URL:
- 'https://api.github.com/repos/rstudio/academyapi/tarball/6e3b86420e053359774468b364fe7f73c53f3f1b'
- Reason: Error: GitHub request failed with Error in get(name, envir = asNamespace(pkg), inherits = FALSE): object 'github_pat' not found

HTTP errors would now appear like:

Error in value[[3L]](cond) : Failed to download package from URL:
- 'https://api.github.com/repos/rstudio/academyapi/tarball/6e3b86420e053359774468b364fe7f73c53f3f1b'
- Reason: Error: GitHub request failed with Error: Unable to download package from GitHub; check the GITHUB_PAT environment variable: Client error: (404) Not Found

Fixes #651

aronatkins commented 2 years ago

@kevinushey - downloadWithRetries no longer calls the githubDownload family of functions. They were always being called outside downloadWithRetries whenever the canUseGitHubDownloader family of functions was truthy.

In other words: The code was live and we checked the logic, but it would never actually dispatch to the githubDownload function because getSourceForPkgRecord always bypasses downloadWithRetries when canUseGitHubDownloader.

Related: I think we will eventually want downloadWithRetries to expose more information about its download errors, but did not want to tackle that with this work.

aronatkins commented 2 years ago

Received a verbal +1 from @kevinushey.