-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added pre-commit hooks for checking and updating news in projects usi…
…ng pre-commit (#498) * added ``towncrier-check`` to just check newly commited news fragments * added ``towncrier-update`` to actually update the news * added documentation section for ``pre-commit``
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- id: towncrier-check | ||
name: towncrier-check | ||
description: Check towncrier changelog updates | ||
entry: towncrier --draft | ||
pass_filenames: false | ||
types: [text] | ||
files: newsfragments/ | ||
language: python | ||
- id: towncrier-update | ||
name: towncrier-update | ||
description: Update changelog with towncrier | ||
entry: towncrier | ||
pass_filenames: false | ||
args: ["--yes"] | ||
files: newsfragments/ | ||
language: python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ Reference | |
|
||
cli | ||
configuration | ||
pre-commit | ||
customization/index | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
pre-commit | ||
========== | ||
|
||
``towncrier`` can also be used in your `pre-commit <https://pre-commit.com/>`_ configuration (``.pre-commit-config.yaml``) | ||
to check and/or update your news fragments on commit or during CI processes. | ||
|
||
No additional configuration is needed in your ``towncrier`` configuration, the hook will read from the appropriate configuration | ||
files in your project. | ||
|
||
|
||
Examples | ||
-------- | ||
|
||
Usage with the default configuration | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code-block:: yaml | ||
repos: | ||
- repo: https://github.com/twisted/towncrier | ||
- rev: trunk | ||
- hooks: | ||
- id: towncrier-check | ||
Usage with custom configuration and directories | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
News fragments are stored in ``changelog.d/`` in the root of the repository and we want to keep the news fragments when | ||
running ``update``: | ||
|
||
.. code-block:: yaml | ||
repos: | ||
- repo: https://github.com/twisted/towncrier | ||
- rev: trunk | ||
- hooks: | ||
- id: towncrier-update | ||
files: $changelog\.d/ | ||
args: ['--keep'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added pre-commit hooks for checking and updating news in projects using pre-commit. |