From 1f1e97f9c515fe3db8b2187dc2df9e7259a9c79c Mon Sep 17 00:00:00 2001 From: Sierra Johnson Date: Fri, 19 Sep 2025 10:12:54 -0600 Subject: [PATCH 1/2] add warning for use_pkgdown not on main fixes #2065 --- R/pkgdown.R | 11 +++++++++++ man/usethis-package.Rd | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/R/pkgdown.R b/R/pkgdown.R index 6de39233d..5488651d2 100644 --- a/R/pkgdown.R +++ b/R/pkgdown.R @@ -31,6 +31,17 @@ use_pkgdown <- function(config_file = "_pkgdown.yml", destdir = "docs") { check_is_package("use_pkgdown()") check_installed("pkgdown") + default_branch <- if (online) { + git_default_branch_(cfg) + } else { + guess_local_default_branch() + } + challenge_non_default_branch( + "Your site will not build until this branch is merged with + {.val {default_branch}}. Do you want to continue on this branch?", + default_branch = default_branch + ) + use_build_ignore(c(config_file, destdir, "pkgdown")) use_git_ignore(destdir) diff --git a/man/usethis-package.Rd b/man/usethis-package.Rd index f53350890..218422d6d 100644 --- a/man/usethis-package.Rd +++ b/man/usethis-package.Rd @@ -31,7 +31,7 @@ Authors: Other contributors: \itemize{ - \item Posit Software, PBC (\href{https://ror.org/03wc8by49}{ROR}) [copyright holder, funder] + \item Posit Software, PBC (03wc8by49) [copyright holder, funder] } } From 6f25fb51032682e44ad654c385040d4ba3256a99 Mon Sep 17 00:00:00 2001 From: Sierra Johnson Date: Fri, 19 Sep 2025 10:54:19 -0600 Subject: [PATCH 2/2] moving warning to github_pages function --- R/pkgdown.R | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/R/pkgdown.R b/R/pkgdown.R index 5488651d2..962069b85 100644 --- a/R/pkgdown.R +++ b/R/pkgdown.R @@ -31,17 +31,6 @@ use_pkgdown <- function(config_file = "_pkgdown.yml", destdir = "docs") { check_is_package("use_pkgdown()") check_installed("pkgdown") - default_branch <- if (online) { - git_default_branch_(cfg) - } else { - guess_local_default_branch() - } - challenge_non_default_branch( - "Your site will not build until this branch is merged with - {.val {default_branch}}. Do you want to continue on this branch?", - default_branch = default_branch - ) - use_build_ignore(c(config_file, destdir, "pkgdown")) use_git_ignore(destdir) @@ -80,6 +69,20 @@ use_pkgdown_github_pages <- function() { tr <- target_repo(github_get = TRUE, ok_configs = c("ours", "fork")) check_can_push(tr = tr, "to turn on GitHub Pages") + cfg <- github_remote_config(github_get = NA) + online <- is_online(tr$host) + + default_branch <- if (online) { + git_default_branch_(cfg) + } else { + guess_local_default_branch() + } + challenge_non_default_branch( + "Your site will not build until this branch is merged with + {.val {default_branch}}. Do you want to continue on this branch?", + default_branch = default_branch + ) + use_pkgdown() site <- use_github_pages() use_github_action("pkgdown")