diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 7814fb6e4..cdc2e8b2f 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -7,11 +7,9 @@ on: push: branches: - - master - main pull_request: branches: - - master - main name: R-CMD-check diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index a68547778..0bcb616cc 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,6 +1,7 @@ on: push: - branches: [main, master] + branches: + main name: pkgdown diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26c961fa3..442498fff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,12 +8,12 @@ This repo uses the [tic](https://github.com/ropenscilabs/tic) package for CI. To create a new hook, have a look at the [official documentation](https://pre-commit.com/#new-hooks) on creating new hooks, then have a look -at existing hooks in this repo. The actual executables are defined in [`inst/hooks/`](https://github.com/lorenzwalthert/precommit/tree/master/inst/hooks). In +at existing hooks in this repo. The actual executables are defined in [`inst/hooks/`](https://github.com/lorenzwalthert/precommit/tree/main/inst/hooks). In the script, you can expect the passed command line arguments to be all options, finally the files that should be processed with the hook. For the scripts to become a hook, they need to be *registered* in -[`.pre-commit-hooks.yaml`](https://github.com/lorenzwalthert/precommit/blob/master/.pre-commit-hooks.yaml). As R is not currently a supported language of +[`.pre-commit-hooks.yaml`](https://github.com/lorenzwalthert/precommit/blob/main/.pre-commit-hooks.yaml). As R is not currently a supported language of pre-commit (https://github.com/pre-commit/pre-commit/issues/926), most hooks use `language: script` and then a shebang in the `entrypoint` script. @@ -21,7 +21,7 @@ pre-commit (https://github.com/pre-commit/pre-commit/issues/926), most hooks use Hooks should be tested by checking both the positive outcome (hook passes) and the negative outcome (hook fails) by adding two `run_test()` statements to -[`./tests/testthat/test-all.R`](https://github.com/lorenzwalthert/precommit/blob/master/tests/testthat/test-all.R). Look at existing examples and [the documentation +[`./tests/testthat/test-all.R`](https://github.com/lorenzwalthert/precommit/blob/main/tests/testthat/test-all.R). Look at existing examples and [the documentation of `run_test()`](https://lorenzwalthert.github.io/precommit/reference/run_test.html). Note that this won't actually use pre-commit. It will simply call the hook script the same way as pre-commit would, with the difference that the test uses a path to the `Rscript` executable whereas with pre-commit, the diff --git a/NEWS.md b/NEWS.md index 21070960b..b7dcea5cc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,8 @@ includes switching to R based hook for `readme-rmd-render`, avoiding the used packages, roxygen snippet generation and more. In addition: * Always sort `inst/WORDLIST` (#303). +* rename default branch to *main* (#307). + # precommit v0.1.3.9012 diff --git a/R/config.R b/R/config.R index cb34ee058..27297a0e2 100644 --- a/R/config.R +++ b/R/config.R @@ -126,5 +126,5 @@ set_config_source <- function(config_source, example_remote_config <- function() { - "https://raw.githubusercontent.com/lorenzwalthert/precommit/master/inst/pre-commit-config-proj.yaml" + "https://raw.githubusercontent.com/lorenzwalthert/precommit/main/inst/pre-commit-config-proj.yaml" } diff --git a/R/release.R b/R/release.R index 860746d49..994e5ba23 100644 --- a/R/release.R +++ b/R/release.R @@ -18,7 +18,7 @@ #' #' @section CRAN release: #' If `is_cran` is `TRUE`, the workflow is changed slightly: -#' - push to release branch, not master. +#' - push to release branch, not main. #' - doesn't run [release_complete()]. This must be done manually after accepted #' on CRAN. #' @keywords internal @@ -27,7 +27,7 @@ release_gh <- function(bump = "dev", is_cran = bump != "dev") { new_dsc$write() git_branch_set(is_cran) if (!is_cran) { - on.exit(sys_call("git", c("checkout", "master")), add = TRUE) + on.exit(sys_call("git", c("checkout", "main")), add = TRUE) } # if we fail, must reset version, if we succeed, it's not stage @@ -78,12 +78,12 @@ release_gh <- function(bump = "dev", is_cran = bump != "dev") { #' @param tag The tag to push. `NULL` will derive the tag from `DESCRIPTION`. #' @keywords internal release_complete <- function(ask = TRUE, is_cran = ask, tag = NULL) { - if (git_branch_get() != "master") { - rlang::abort("Must be on master to complete the release.") + if (git_branch_get() != "main") { + rlang::abort("Must be on main to complete the release.") } if (ask) { - abort_if_not_yes("Did you merge the release branch into master?") - abort_if_not_yes("Did you pull the latest master from origin?") + abort_if_not_yes("Did you merge the release branch into main?") + abort_if_not_yes("Did you pull the latest main from origin?") } if (is_cran) { if (is.null(tag)) { @@ -94,7 +94,7 @@ release_complete <- function(ask = TRUE, is_cran = ask, tag = NULL) { } sys_call("git", glue::glue("push origin {tag}")) } - precommit::autoupdate() # only updates if tag is on the master branch + precommit::autoupdate() # only updates if tag is on the main branch desc::desc_bump_version("dev") cli::cli_alert_success("Bumped version to dev") sys_call("git", glue::glue('commit DESCRIPTION .pre-commit-config.yaml -m "use latest release"'), @@ -184,9 +184,9 @@ git_branch_set <- function(is_cran) { ) cli::cli_alert_success("Checked out branch {branch_name} for CRAN release process.") } else { - if (git_branch_get() != "master") { + if (git_branch_get() != "main") { rlang::abort(paste( - "Need to be on branch 'master' to create a release, otherwise autoudate", + "Need to be on branch 'main' to create a release, otherwise autoudate", "won't use the new ref." )) } @@ -196,9 +196,9 @@ git_branch_set <- function(is_cran) { git_assert_even_with_origin <- function() { tmp <- tempfile() - system2("git", "diff HEAD..origin/master", stdout = tmp) + system2("git", "diff HEAD..origin/main", stdout = tmp) if (length(readLines(tmp) > 0)) { - rlang::abort("remote master must be even with local master before release process can start.") + rlang::abort("remote main must be even with local main before release process can start.") } } diff --git a/man/release_gh.Rd b/man/release_gh.Rd index 16ecdbaaa..070947d90 100644 --- a/man/release_gh.Rd +++ b/man/release_gh.Rd @@ -33,7 +33,7 @@ not possible interactively, hence we run in advance). If \code{is_cran} is \code{TRUE}, the workflow is changed slightly: \itemize{ -\item push to release branch, not master. +\item push to release branch, not main. \item doesn't run \code{\link[=release_complete]{release_complete()}}. This must be done manually after accepted on CRAN. } diff --git a/vignettes/FAQ.Rmd b/vignettes/FAQ.Rmd index 18ed07c0f..2d9430843 100644 --- a/vignettes/FAQ.Rmd +++ b/vignettes/FAQ.Rmd @@ -91,7 +91,7 @@ described [here](https://pre-commit.com/#temporarily-disabling-hooks). ## How does one create a new pre-commit hook? -How to contribute new hooks is explained in [`CONTRIBUTING.md`](https://github.com/lorenzwalthert/precommit/blob/master/CONTRIBUTING.md). +How to contribute new hooks is explained in [`CONTRIBUTING.md`](https://github.com/lorenzwalthert/precommit/blob/main/CONTRIBUTING.md). ***