Skip to content

Commit fc42b7e

Browse files
Merge pull request #431 from lorenzwalthert/issue-421
Fix docs
2 parents 7a118ef + 38feb38 commit fc42b7e

File tree

5 files changed

+39
-17
lines changed

5 files changed

+39
-17
lines changed

NEWS.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@ editor_options:
44
wrap: 72
55
---
66

7+
# precommit v0.3.2.9000
8+
9+
- `use_ci()` is now documented to take `NA`, not `NULL` for argument
10+
`ci` (#431).
11+
712
# precommit v0.3.2
813

914
- `parsable-R` hook now gives more context on where and how parsing
1015
fails (#423).
1116
- fixed R CMD check issues in devel (#425).
1217
- move from *experimental* to *stable* (#426).
1318

14-
Thanks to [@danielinteractive](https://github.com/danielinteractive), [@jonocarroll](https://github.com/jonocarroll) for their contributions.
19+
Thanks to [\@danielinteractive](https://github.com/danielinteractive),
20+
[\@jonocarroll](https://github.com/jonocarroll) for their contributions.
1521

1622
# precommit v0.3.1
1723

@@ -40,7 +46,8 @@ Thanks to [@danielinteractive](https://github.com/danielinteractive), [&#
4046
- All (R)md files in that repo are now formatted in a pandoc-compliant
4147
way (#415).
4248

43-
Thanks to [@danielinteractive](https://github.com/danielinteractive) and [@mpadge](https://github.com/mpadge) for their contributions.
49+
Thanks to [\@danielinteractive](https://github.com/danielinteractive)
50+
and [\@mpadge](https://github.com/mpadge) for their contributions.
4451

4552
# precommit v0.3.0
4653

R/release.R

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,25 @@ release_gh <- function(bump = "dev", is_cran = bump != "dev") {
4343
purrr::walk(path_template_config, update_rev_in_config,
4444
new_version = new_version
4545
)
46-
last_release <- call_and_capture("git", "tag -l --sort=-taggerdate")$stdout[1]
4746

47+
last_release <- git_last_release()
4848
cli::cli_alert_success("Updated version in default config.")
49-
msg1 <- glue::glue("Release {new_version}, see NEWS.md for details.")
50-
msg2 <- glue::glue(
51-
"Diff to previous release: ",
52-
"https://github.com/lorenzwalthert/precommit/compare/",
53-
"{last_release}...{new_version}"
54-
)
5549
sys_call(
5650
"git",
5751
glue::glue(
5852
'commit DESCRIPTION {paste0(path_template_config, collapse = " ")} ',
59-
'-m "{msg1}" -m "{msg2}"'
53+
'-m "{release_msg1(last_release, new_version)}"'
6054
),
6155
env = "SKIP=spell-check,consistent-release-tag"
6256
)
6357
cli::cli_alert_success("Committed DESCRIPTION and config template")
64-
sys_call("git", glue::glue('tag -a {new_version} -m "{msg1}" -m "{msg2}"'))
58+
if (!is_cran) {
59+
60+
}
6561
sys_call("./inst/hooks/local/consistent-release-tag.R", "--release-mode")
6662
cli::cli_alert_success("Tagged last commit with release version.")
6763
if (!is_cran) {
68-
sys_call("git", glue::glue("push origin {new_version}"),
69-
env = "SKIP=consistent-release-tag"
70-
)
64+
git_tag_release(last_release, new_version)
7165
}
7266

7367
sys_call("git", glue::glue("push"),
@@ -84,6 +78,24 @@ release_gh <- function(bump = "dev", is_cran = bump != "dev") {
8478
}
8579
}
8680

81+
git_tag_release <- function(last_release, new_version) {
82+
sys_call("git", glue::glue('tag -a {new_version} -m "{release_msg(last_release, new_version)}"'))
83+
}
84+
85+
git_last_release <- function() {
86+
call_and_capture("git", "tag -l --sort=-taggerdate")$stdout[1]
87+
}
88+
89+
release_msg <- function(last_release, new_version) {
90+
glue::glue(
91+
"Release {new_version}, see NEWS.md for details.\n\n",
92+
"Diff to previous release: ",
93+
"https://github.com/lorenzwalthert/precommit/compare/",
94+
"{last_release}...{new_version}"
95+
)
96+
}
97+
98+
8799
#' Complete the release
88100
#'
89101
#' Bumps the version to devel.
@@ -104,6 +116,9 @@ release_complete <- function(ask = TRUE, is_cran = ask, tag = NULL) {
104116
if (substr(tag, 1, 1) != "v") {
105117
rlang::abort("tag must start with v.")
106118
}
119+
git_tag_release(
120+
last_release = git_last_release(), new_version = tag
121+
)
107122
sys_call("git", glue::glue("push origin {tag}"))
108123
}
109124
autoupdate() # only updates if tag is on the main branch

R/setup.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use_precommit <- function(config_source = getOption("precommit.config_source"),
7777
#' `"native"` on package loading (if unset). `"native"` sets up
7878
#' [pre-commit.ci](https://pre-commit.ci). Alternatively, `"gha"` can be used
7979
#' to set up [GitHub Actions](https://github.com/features/actions). Set value
80-
#' to `NULL` if you don't want to use a continuous integration.
80+
#' to `NA` if you don't want to use a continuous integration.
8181
#' @param force Whether or not to overwrite an existing ci config file (only
8282
#' relevant for `ci = "gha"`).
8383
#' @param open Whether or not to open [pre-commit.ci](https://pre-commit.ci)

man/use_ci.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/use_precommit.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)