Skip to content

Commit

Permalink
rely on specific date to ensure archived binaries are still present
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert committed Nov 20, 2023
1 parent c827f9d commit 42e7cd3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/hook-dependencies-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
Rscript -e "install.packages('remotes'); remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: update PPM URL
run: Rscript inst/update-ppm-url.R
- name: update dependency graph among packages
run: Rscript inst/update-existing-hook-dependencies.R
- name: update existing packages
Expand Down
12 changes: 12 additions & 0 deletions inst/update-ppm-url.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# old binaries only guaranteed to be available for frozen snapshot
# https://community.rstudio.com/t/binary-packages-removed-once-new-package-version-released-on-ppm/177282/2
lockfile = renv::lockfile_read()
rspm_url = lockfile$R$Repositories$RSPM
current_date <- Sys.Date() - 3 # available for sure

to_substract <- max(0, as.integer(strftime(current_date,'%u')) - 5)
ensured_weekday <- current_date - to_substract
cat(paste0("Snapshot day for PPM moved to ", ensured_weekday))
updated_url <- gsub("[0-9]{4}-[0-9]{2}-[0-9]{2}$", ensured_weekday, rspm_url)
lockfile$R$Repositories$RSPM <- updated_url
renv::lockfile_write(lockfile = lockfile)
2 changes: 1 addition & 1 deletion renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Repositories": [
{
"Name": "RSPM",
"URL": "https://packagemanager.posit.co/cran/2023-11-15"
"URL": "https://packagemanager.posit.co/cran/2023-11-17"
},
{
"Name": "CRAN",
Expand Down

0 comments on commit 42e7cd3

Please sign in to comment.