Skip to content

Commit

Permalink
Add .gitkeep as an ignored filename (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban authored Aug 3, 2024
2 parents fc3a255 + 4faf7f7 commit afa6cc0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
13 changes: 11 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,20 @@ Top level keys
``ignore``
A case-insensitive list of filenames in the news fragments directory to ignore.

``None`` by default.

``towncrier check`` will fail if there are any news fragment files that have invalid filenames, except for those in the list. ``towncrier build`` will likewise fail, but only if this list has been configured (set to an empty list if there are no files to ignore).

Some filenames such as .gitignore, README.rst. README.md, and the template file, are automatically ignored.
The following filenames are automatically ignored, case insensitive.

- ``.gitignore``
- ``.gitkeep``
- ``.keep``
- ``README``
- ``README.md``
- ``README.rst``
- the template file itself

``None`` by default.

Extra top level keys for Python projects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
9 changes: 8 additions & 1 deletion src/towncrier/_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ def find_fragments(
If strict, raise ClickException if any fragments have an invalid name.
"""
ignored_files = {".gitignore", ".keep", "readme", "readme.md", "readme.rst"}
ignored_files = {
".gitignore",
".gitkeep",
".keep",
"readme",
"readme.md",
"readme.rst",
}
if isinstance(config.template, str):
# Template can be a tuple of (package_name, resource_name).
#
Expand Down
1 change: 1 addition & 0 deletions src/towncrier/newsfragments/643.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``.gitkeep`` as an ignored filename.

0 comments on commit afa6cc0

Please sign in to comment.