Skip to content

Commit

Permalink
Removing GITHUB_PAT check test as GitHub actions won't return the env…
Browse files Browse the repository at this point in the history
…ironment variable to the test script
  • Loading branch information
rmbielby committed Nov 12, 2024
1 parent fd8d896 commit 1ea5261
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
14 changes: 5 additions & 9 deletions R/diagnostic_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,13 @@ check_proxy_settings <- function(
#'
#' @examples
#' check_github_pat()
check_github_pat <- function(clean = FALSE,
verbose = FALSE) {
github_pat <- Sys.getenv("GITHUB_PAT", unset = NA) |>
stringr::str_replace_all(stringr::regex("\\W+"), "")
check_github_pat <- function(
clean = FALSE,

Check warning on line 96 in R/diagnostic_test.R

View workflow job for this annotation

GitHub Actions / lint

file=R/diagnostic_test.R,line=96,col=4,[indentation_linter] Indentation should be 2 spaces but is 4 spaces.
verbose = FALSE

Check warning on line 97 in R/diagnostic_test.R

View workflow job for this annotation

GitHub Actions / lint

file=R/diagnostic_test.R,line=97,col=29,[indentation_linter] Indentation should be 2 spaces but is 29 spaces.
) {

Check warning on line 98 in R/diagnostic_test.R

View workflow job for this annotation

GitHub Actions / lint

file=R/diagnostic_test.R,line=98,col=4,[indentation_linter] Indentation should be 0 spaces but is 4 spaces.
github_pat <- Sys.getenv("GITHUB_PAT")
# Replace above to remove non alphanumeric characters when run on GitHub
# Actions
print(Sys.info())
print(github_pat)
print(pillar::type_sum(github_pat))
print(typeof(github_pat))
cat("==================================")
if (!is.na(github_pat)) {
message(
Expand All @@ -120,7 +117,6 @@ check_github_pat <- function(clean = FALSE,
}
} else {
message("PASS: The GITHUB_PAT system variable is clear.")
github_pat <- ""
}
return(list(GITHUB_PAT = github_pat))
}
Expand Down
10 changes: 0 additions & 10 deletions tests/testthat/test-diagnostic_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ test_that("Check proxy settings identifies and removes proxy setting", {
)
})

test_that("Test GITHUB_PAT diagnostic check", {
# Check that check_proxy_settings identifies the rogue entry
expect_equal(
check_github_pat(
clean = FALSE
),
list(GITHUB_PAT = "")
)
})

test_that("Check RENV_DOWNLOAD_METHOD", {
# Check that check_proxy_settings identifies the rogue entry
expect_equal(
Expand Down

0 comments on commit 1ea5261

Please sign in to comment.