Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

* `pr_resume()` (without a specific `branch`) and `pr_fetch()` (without a specific `number`) no longer error when a branch name contains curly braces (#2107, @jonthegeek).

* `git_default_branch_rename()`, if appropriate, offers a reminder to update
codecov configuration (#2078, @ijlyttle).

# usethis 3.2.1

* `create_quarto_project()` exits early if the Quarto CLI does not appear to be
Expand Down
20 changes: 20 additions & 0 deletions R/git-default-branch.R
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ report_fishy_files <- function(old_name = "master", new_name = "main") {
try(fishy_github_actions(new_name = new_name), silent = TRUE)
try(fishy_badges(old_name = old_name), silent = TRUE)
try(fishy_bookdown_config(old_name = old_name), silent = TRUE)
try(fishy_codecov_config(new_name = new_name), silent = TRUE)
}

# good test cases: downlit, purrr, pkgbuild, zealot, glue, bench,
Expand Down Expand Up @@ -674,3 +675,22 @@ fishy_bookdown_config <- function(old_name = "master") {

invisible(path)
}

fishy_codecov_config <- function(new_name = "main") {
path <- proj_path("codecov.yml")

if (!file_exists(path)) {
return(invisible(character()))
}

repo_spec <- target_repo_spec()
url <- glue("https://app.codecov.io/gh/{repo_spec}")

ui_bullets(c(
"-" = "Check and correct, if needed, your
{.href [codecov configuration]({url})}
to refer to the new default branch {.val {new_name}}."
))

invisible(path)
}
4 changes: 4 additions & 0 deletions tests/testthat/test-git-default-branch.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ test_that("git_default_branch_rename() surfaces files that smell fishy", {
file = path("whatever", "foo", "_bookdown.yaml")
)

# The code to remind about updating codecov configuration,
# `fishy_codecov_config()`, is not tested because it depends
# on the location of a GitHub remote, which does not exist in this test.

withr::local_options(usethis.quiet = FALSE)
expect_snapshot(
git_default_branch_rename()
Expand Down
Loading