Skip to content

Commit 28ca478

Browse files
Merge pull request #765 from lorenzwalthert/enforce-news-update-on-push
- Enforce news update on push (#765).
2 parents a6da1da + 381d524 commit 28ca478

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ revdep
2121
^touchstone$
2222
^\.github$
2323
^LICENSE\.md$
24+
^inst/hooks/$
25+
^inst/WORDLIST$

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# All available hooks: https://pre-commit.com/hooks.html
22
# R specific hooks: https://github.com/lorenzwalthert/precommit
3+
default_stages: [commit]
4+
35
repos:
46
- repo: https://github.com/lorenzwalthert/precommit
57
rev: v0.1.2.9001
@@ -56,3 +58,10 @@ repos:
5658
language: fail
5759
files: '\.Rhistory|\.RData|\.Rds|\.rds$'
5860
# `exclude: <regex>` to allow committing specific files.
61+
- id: require-news-on-push
62+
name: Require bullet in NEWS.md
63+
description: NEWS.md must be updated with every PR.
64+
entry: inst/hooks/require-news-update.R
65+
stages: [push]
66+
language: script
67+
files: ""

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# styler 1.4.0.9000 (Development)
22

33
* Hexadecimal integers now preserve the trailing `L` when styled (#761).
4-
54
* Add more examples to `styler_*` helpfiles (#762).
5+
* Add a pre-push hook to make sure news bullets are added to each PR (#765).
6+
67
# styler 1.4.0
78

89
## API Changes

inst/WORDLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ github
7373
gitsum
7474
GSOC
7575
hashFiles
76+
helpfiles
7677
href
7778
http
7879
https

inst/hooks/require-news-update.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! /usr/local/bin/Rscript
2+
args <- system2(
3+
"git",
4+
c("diff", "upstream/master", "--name-only"),
5+
stdout = TRUE
6+
)
7+
8+
if (!any(args == "NEWS.md")) {
9+
rlang::abort("Must have a news entry before pushing.")
10+
}

0 commit comments

Comments
 (0)