diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index bd0a6bc6..fcc8e885 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -8,13 +8,13 @@ name: pkgdown jobs: pkgdown: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 - uses: r-lib/actions/setup-pandoc@v1 diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index c4c906e8..ef43d1f9 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -7,13 +7,13 @@ name: test-coverage jobs: test-coverage: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 - uses: r-lib/actions/setup-pandoc@v1 diff --git a/R/read_log_file.R b/R/read_log_file.R index 9b8b0fc2..e226fbe3 100644 --- a/R/read_log_file.R +++ b/R/read_log_file.R @@ -191,27 +191,42 @@ parse_log <- function(nested_log) { fill = "right" ) %>% dplyr::mutate(dplyr::across(tidyselect::where(is.character), stringr::str_trim)) - parsed_log$`Session Information`$`Packages` <- nested_log$`Session Information`$`Packages` %>% # remove indicator whether the package is attached to the search path stringr::str_replace_all("\\*", " ") %>% # account for loaded packages due to load_all() stringr::str_replace_all(" P ", " ") %>% - readr::read_table(skip = 1, col_names = FALSE) %>% - dplyr::rename_with(~ c( - "package", - "version", - "date", - "lib", - "source", - "lang", - "r_version" - )) %>% - dplyr::mutate( - lang = stringr::str_remove(lang, "\\("), - r_version = stringr::str_remove(r_version, "\\)") - ) + readr::read_table(skip = 1, col_names = FALSE) + + # handle case where log is has 7 columns due to sessioninfo v1.2.2 or earlier + if (ncol(parsed_log$`Session Information`$`Packages`) == 7) { + parsed_log$`Session Information`$`Packages` <- + parsed_log$`Session Information`$`Packages` %>% + dplyr::rename_with(~ c( + "package", + "version", + "date", + "lib", + "source", + "lang", + "r_version" + )) %>% + dplyr::mutate( + lang = stringr::str_remove(lang, "\\("), + r_version = stringr::str_remove(r_version, "\\)") + ) + } else { + parsed_log$`Session Information`$`Packages` <- + parsed_log$`Session Information`$`Packages` %>% + dplyr::rename_with(~ c( + "package", + "version", + "date", + "lib", + "source" + )) + } parsed_log$`Session Information`$`External software` <- nested_log$`Session Information`$`External software` %>% diff --git a/tests/testthat/test-sha1.R b/tests/testthat/test-sha1.R index 8b758286..cbb9ecee 100644 --- a/tests/testthat/test-sha1.R +++ b/tests/testthat/test-sha1.R @@ -7,7 +7,7 @@ test_that("Test 1: File HashSum does not change for ex1.R", { flines <- readLines(con) close(con) - expect_true(any(grepl("File HashSum: e3b7438926d8fc6e55d927db377c9670a057e0a8", flines) == TRUE)) + expect_true(any(grepl("File HashSum: 69bba3ee00038e547f0a95b6b62d16f9a56a946b", flines) == TRUE)) # remove all the stuff we added rm(scriptPath, logDir)