Skip to content

Commit

Permalink
If status is 403 on getSHAfromGitHub after .downloadFileMaster: stop
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliot McIntire committed Oct 23, 2024
1 parent 3795dd7 commit 50ed66d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Description: A single key function, 'Require' that makes rerun-tolerant
URL:
https://Require.predictiveecology.org,
https://github.com/PredictiveEcology/Require
Date: 2024-09-27
Version: 1.0.1.9001
Date: 2024-10-23
Version: 1.0.1.9002
Authors@R: c(
person(given = "Eliot J B",
family = "McIntire",
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version 1.0.2

## Bugfixes
* minor
* better fails when status is 403 for package dependency checking
* `updatePackages` had 2 minor bugs that prevented some mixtures of necessary updates from being correctly identified.

version 1.0.1
Expand Down
9 changes: 5 additions & 4 deletions R/Require-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,10 @@ getSHAfromGitHub <- function(acct, repo, br, verbose = getOption("Require.verbos
fetf <- file.exists(tf)
gitRefs <- if (fetf) try(suppressWarnings(readLines(tf)), silent = TRUE) else ""
isNotFound <- ((NROW(gitRefs) <= 5) && any(grepl("Not Found", gitRefs) ) ||
(any(grepl("cannot open URL", gitRefs))) || identical(gitRefs, ""))
if (any(grepl("Bad credentials", gitRefs)) || isNotFound) {#} || notFound) {
(any(grepl("cannot open URL", gitRefs))) || identical(gitRefs, "") ||
any(grepl("status.+403", gitRefs)))

if (any(grepl("Bad credentials", gitRefs)) || isNotFound) {
if (fetf) {
unlink(tf)
}
Expand All @@ -1006,10 +1008,9 @@ getSHAfromGitHub <- function(acct, repo, br, verbose = getOption("Require.verbos
mess <- character()
if (is.null(token)) {
mess <- "GitHub repository not accessible does it need authentication? "
stop(paste0(mess, .txtDidYouSpell))
}
stop(paste0(mess, .txtDidYouSpell))
}

stop(gitRefs)
}

Expand Down

0 comments on commit 50ed66d

Please sign in to comment.