Closed maelle closed 1 year ago
probably needs a tweak to not count the same R version twice (see macOS)
Thanks! There are two flavors of macOS, and I see another use case for rematch2:
pkg <- "tibble"
temp_file <- withr::local_tempfile()
curl::curl_download(
sprintf("https://cran.r-project.org/package=%s", pkg),
temp_file
)
pkg_cran_page <- xml2::read_html(temp_file)
pkg_version_pre <- xml2::xml_find_first(pkg_cran_page, ".//td[text()='Version:']")
pkg_version <- xml2::xml_siblings(pkg_version_pre)[[1]] |>
xml2::xml_text()
# treat binaries link
tibblify_binary_link <- function(link) {
rematch2::re_match(link, "/bin/(?<flavor>.+)/contrib/(?<r_version>[^/]+)/[^_]+_(?<binary_version>[-0-9.]+)[.][a-z]+$")
}
# binaries
binaries <- xml2::xml_find_all(
pkg_cran_page,
".//a[starts-with(@href, '../../../bin/')]"
) |>
xml2::xml_attr("href") |>
purrr::map_df(tibblify_binary_link)
# put it together
binaries[["up_to_date"]] <- (binaries[["binary_version"]] == pkg_version)
all_ok <- all(binaries[["up_to_date"]])
binaries
#> # A tibble: 7 × 6
#> flavor r_version binary_version .text .match up_to…¹
#> <chr> <chr> <chr> <chr> <chr> <lgl>
#> 1 windows 4.3 3.2.0 ../../../bin/win… /bin/… TRUE
#> 2 windows 4.2 3.2.0 ../../../bin/win… /bin/… TRUE
#> 3 windows 4.1 3.2.0 ../../../bin/win… /bin/… TRUE
#> 4 macosx/big-sur-arm64 4.2 3.2.0 ../../../bin/mac… /bin/… TRUE
#> 5 macosx/big-sur-arm64 4.1 3.2.0 ../../../bin/mac… /bin/… TRUE
#> 6 macosx 4.2 3.2.0 ../../../bin/mac… /bin/… TRUE
#> 7 macosx 4.1 3.2.0 ../../../bin/mac… /bin/… TRUE
#> # … with abbreviated variable name ¹up_to_date
all_ok
#> [1] TRUE
Created on 2023-03-11 with reprex v2.0.2
How do I detect if a release branch/PR is currently open? How do I get the branch name? How do I switch a clone to that branch?
@krlmlr code that could run every... 4 hours?
Created on 2023-03-10 with reprex v2.0.2