From 129f7c6ee39e1f923987aa5d9de931e776a8c06e Mon Sep 17 00:00:00 2001 From: Vincent Guyader <10470699+VincentGuyader@users.noreply.github.com> Date: Sat, 25 Apr 2026 22:36:01 +0200 Subject: [PATCH] Drop deprecated `repo_name` arg passed to gitlabr::use_gitlab_ci() `gitlabr::use_gitlab_ci()` removed the `repo_name` parameter in 2.1: the CRAN mirror is now read from the `REPO_NAME` GitLab CI/CD variable in the generated YAML (see gitlabr's bookdown-production.yml template), not from a function argument. lozen still passed `repo_name = repo_name` and so errored with `unused argument`. The lozen `repo_name` parameter is kept in the signature for backward compatibility but documented as deprecated and emits a warning when set explicitly. The internal call to gitlabr no longer forwards it. --- DESCRIPTION | 2 +- R/use_gitlab_ci.R | 14 +++++++++++--- dev/flat_init_gitlab_ci.Rmd | 14 +++++++++++--- man/use_gitlab_ci.Rd | 6 ++++-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bb85e39..1402416 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -79,4 +79,4 @@ Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.3 diff --git a/R/use_gitlab_ci.R b/R/use_gitlab_ci.R index 2ad5bb2..819627c 100644 --- a/R/use_gitlab_ci.R +++ b/R/use_gitlab_ci.R @@ -5,10 +5,14 @@ #' Set gitlab continuous integration #' #' @param image Docker image used as basis. See \url{https://github.com/rocker-org/rocker} +#' @param repo_name Deprecated. Kept for backward compatibility but ignored: as of +#' gitlabr 2.1, the CRAN mirror is set via the `REPO_NAME` GitLab CI/CD variable +#' (see \code{inst/gitlab-ci/bookdown-production.yml} in gitlabr) rather than as +#' an argument to `gitlabr::use_gitlab_ci()`. #' @param project_path Path of the project to add CI in. #' @param bookdown_output_format If type="bookdown" it corresponds to the function used to output the bookdown #' @inheritParams gitlabr::use_gitlab_ci -#' @importFrom cli cli_alert_info +#' @importFrom cli cli_alert_info cli_alert_warning #' #' @details See \code{\link[gitlabr]{use_gitlab_ci}} #' @@ -21,7 +25,6 @@ #' withr::with_tempdir({ #' use_gitlab_ci( #' image = "rocker/verse", -#' repo_name = "https://packagemanager.rstudio.com/all/__linux__/focal/latest", #' type = "check-coverage-pkgdown" #' ) #' }) @@ -33,6 +36,12 @@ use_gitlab_ci <- function( bookdown_output_format = c("lozen::paged_template", "lozen::bs4_book_template"), overwrite = TRUE ) { + if (!missing(repo_name)) { + cli_alert_warning( + "Argument `repo_name` is deprecated and ignored: gitlabr 2.1+ takes the CRAN mirror from the REPO_NAME CI/CD variable, not from a function argument." + ) + } + ci_file <- file.path(project_path, ".gitlab-ci.yml") if ( @@ -62,7 +71,6 @@ use_gitlab_ci <- function( gitlabr::use_gitlab_ci( image = image, - repo_name = repo_name, path = ci_file, type = type ) diff --git a/dev/flat_init_gitlab_ci.Rmd b/dev/flat_init_gitlab_ci.Rmd index e28c04b..dbd0a49 100644 --- a/dev/flat_init_gitlab_ci.Rmd +++ b/dev/flat_init_gitlab_ci.Rmd @@ -24,10 +24,14 @@ pkgload::load_all(export_all = FALSE) #' Set gitlab continuous integration #' #' @param image Docker image used as basis. See \url{https://github.com/rocker-org/rocker} +#' @param repo_name Deprecated. Kept for backward compatibility but ignored: as of +#' gitlabr 2.1, the CRAN mirror is set via the `REPO_NAME` GitLab CI/CD variable +#' (see \code{inst/gitlab-ci/bookdown-production.yml} in gitlabr) rather than as +#' an argument to `gitlabr::use_gitlab_ci()`. #' @param project_path Path of the project to add CI in. #' @param bookdown_output_format If type="bookdown" it corresponds to the function used to output the bookdown #' @inheritParams gitlabr::use_gitlab_ci -#' @importFrom cli cli_alert_info +#' @importFrom cli cli_alert_info cli_alert_warning #' #' @details See \code{\link[gitlabr]{use_gitlab_ci}} #' @@ -40,6 +44,12 @@ use_gitlab_ci <- function( bookdown_output_format = c("lozen::paged_template", "lozen::bs4_book_template"), overwrite = TRUE ) { + if (!missing(repo_name)) { + cli_alert_warning( + "Argument `repo_name` is deprecated and ignored: gitlabr 2.1+ takes the CRAN mirror from the REPO_NAME CI/CD variable, not from a function argument." + ) + } + ci_file <- file.path(project_path, ".gitlab-ci.yml") if ( @@ -69,7 +79,6 @@ use_gitlab_ci <- function( gitlabr::use_gitlab_ci( image = image, - repo_name = repo_name, path = ci_file, type = type ) @@ -150,7 +159,6 @@ withr::with_tempdir({ withr::with_tempdir({ use_gitlab_ci( image = "rocker/verse", - repo_name = "https://packagemanager.rstudio.com/all/__linux__/focal/latest", type = "check-coverage-pkgdown" ) }) diff --git a/man/use_gitlab_ci.Rd b/man/use_gitlab_ci.Rd index 1827359..f9f3cb1 100644 --- a/man/use_gitlab_ci.Rd +++ b/man/use_gitlab_ci.Rd @@ -16,7 +16,10 @@ use_gitlab_ci( \arguments{ \item{image}{Docker image used as basis. See \url{https://github.com/rocker-org/rocker}} -\item{repo_name}{REPO_NAME environment variable for R CRAN mirror used} +\item{repo_name}{Deprecated. Kept for backward compatibility but ignored: as of +gitlabr 2.1, the CRAN mirror is set via the \code{REPO_NAME} GitLab CI/CD variable +(see \code{inst/gitlab-ci/bookdown-production.yml} in gitlabr) rather than as +an argument to \code{gitlabr::use_gitlab_ci()}.} \item{project_path}{Path of the project to add CI in.} @@ -40,7 +43,6 @@ withr::with_tempdir({ withr::with_tempdir({ use_gitlab_ci( image = "rocker/verse", - repo_name = "https://packagemanager.rstudio.com/all/__linux__/focal/latest", type = "check-coverage-pkgdown" ) })