Skip to content

Commit

Permalink
added support for GITLAB_PAT
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjacton committed Sep 1, 2022
1 parent b7cd508 commit 5542a63
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/credentials.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ make_cred_cb <- function(password = askpass, verbose = TRUE){
# Look for GITHUB_PAT variable
if(retries < 2){
github_pat <- Sys.getenv('GITHUB_PAT')
if(nchar(github_pat) > 0 && grepl('^https?://([^/]*@)?github.com', url)){
gitlab_pat <- Sys.getenv('GITLAB_PAT')
if(nchar(github_pat) > 0 && nchar(gitlab_pat) > 0) {
warning("GITHUB_PAT & GITLAB_PAT are set! Defaulting to GITHUB_PAT.\n Unset the variable to change this")
}
if(grepl('^https?://([^/]*@)?github.com', url)){
return(c("git", github_pat))
} else if (nchar(gitlab_pat) > 0) {
return(c("git", gitlab_pat))
}
}

Expand Down

0 comments on commit 5542a63

Please sign in to comment.