1
0
mirror of https://github.com/timescale/timescaledb.git synced 2025-05-16 02:23:49 +08:00
timescaledb/scripts/check_changelog_format.py
Maheedhar PV 38ee7f49b0 Every PR to have its own changelog
The changes in this commit
1. workflow action to check if the PR has its own changelog file in
".unreleased/" folder.
2. script to merge the individual changelog entries that can be copied
into the CHANGELOG.md file.
3. script to check the format of the lines in the change log file.
4. script to delete the individual changelogs, post release.
2023-05-19 13:51:37 +05:30

35 lines
925 B
Python
Executable File

#!/usr/bin/env python3
import sys
import re
# Check if a line matches any of the specified patterns
def is_valid_line(line):
patterns = [r"^Fixes:\s*.*$", r"^Implements:\s*.*$", r"^Thanks:\s*.*$"]
for pattern in patterns:
if re.match(pattern, line):
return True
return False
def main():
# Get the file name from the command line argument
if len(sys.argv) > 1:
file_name = sys.argv[1]
# Read the file and check non-empty lines
with open(file_name, "r", encoding="utf-8") as file:
for line in file:
line = line.strip()
if line and not is_valid_line(line):
print(f'Invalid entry in change log: "{line}"')
sys.exit(1)
else:
print("Please provide a file name as a command-line argument.")
sys.exit(1)
sys.exit(0)
if __name__ == "__main__":
main()