Skip to content

Commit

Permalink
Update curatinator to search cran pkgs more insistently & switch to a…
Browse files Browse the repository at this point in the history
…ctions/checkout@v4 (rweekly#1640)
  • Loading branch information
jonmcalder authored Jun 1, 2024
1 parent a3b6a9d commit 3fada9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
any::pkgsearch
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Collect content
run: Rscript -e 'source("scripts/curatinator.R")'
Expand Down
8 changes: 7 additions & 1 deletion scripts/curatinator.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ create_text <- function(package_version, package_name, package_title, feed_type
return(x)
}

search_cran_package_insistently <- purrr::insistently(
pkgsearch::cran_package,
rate = purrr::rate_backoff(pause_base = 1, pause_cap = 5, max_times = 3),
quiet = TRUE
)

process_cranberries <- function(feed_type, start_date, end_date = as.Date(lubridate::now())) {
# form the URL based on type (either "new" or "updated")
cb_url <- glue::glue("https://dirk.eddelbuettel.com/cranberries/cran/{feed_type}/index.rss")
Expand All @@ -57,7 +63,7 @@ process_cranberries <- function(feed_type, start_date, end_date = as.Date(lubrid
mutate(package_name = purrr::map_chr(item_link, ~tidy_package_name(.x))) %>%

# leverage the awesome pkgsearch package to get metadata
mutate(package_meta = purrr::map(package_name, ~pkgsearch::cran_package(.x)),
mutate(package_meta = purrr::map(package_name, ~search_cran_package_insistently(.x)),
package_version = purrr::map_chr(package_meta, "Version"),
package_title = purrr::map_chr(package_meta, "Title"),
package_date = purrr::map_chr(package_meta, "Date/Publication")) %>%
Expand Down

0 comments on commit 3fada9b

Please sign in to comment.