Make changelog tool be more strict about suffixes (#70798)

* Make changelog tool be more strict about suffixes

Change:
- Files must end in .yml or .yaml, and must not be dotfiles.
- This is to prevent (for example) emacs backup files (.yml~) from being
  included in changelogs during releases.
- Backport of https://github.com/ansible-community/antsibull-changelog/pull/33

Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
Rick Elrod 2020-07-23 19:26:15 -05:00 committed by GitHub
parent 4d675b6d87
commit 53a1885ab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -211,6 +211,9 @@ def load_fragments(paths=None, exceptions=None):
fragments = []
for path in paths:
bn_path = os.path.basename(path)
if bn_path.startswith('.') or not bn_path.endswith(('.yml', '.yaml')):
continue
try:
fragments.append(ChangelogFragment.load(path))
except Exception as ex:

View file

@ -18,6 +18,9 @@ def main():
if ext not in allowed_extensions:
print('%s:%d:%d: extension must be one of: %s' % (path, 0, 0, ', '.join(allowed_extensions)))
if os.path.basename(path).startswith('.'):
print('%s:%d:%d: file must not be a dotfile' % (path, 0, 0))
cmd = ['packaging/release/changelogs/changelog.py', 'lint'] + paths
subprocess.check_call(cmd)