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:
parent
4d675b6d87
commit
53a1885ab5
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue