Files
harfbuzz/src/check-release-notes.py
T
Khaled Hosny 5a443ade9f [ci] Add a script to extract release notes from NEWS file
Add a script to extract the release notes from the NEWS files and use
them when creating GitHub releases, so that we don’t need to copy them
manually.

Add also a test to make sure the NEWS file always have release notes for
the current release.
2025-07-30 01:19:29 +03:00

25 lines
591 B
Python
Executable File

#!/usr/bin/env python3
import sys
news_path = sys.argv[1]
release = sys.argv[2]
with open(news_path, "r", encoding="utf-8") as news_file:
lines = news_file.readlines()
start = None
end = None
for i, line in enumerate(lines):
line = line.rstrip()
if line.startswith("Overview of changes leading to"):
if start is not None: # Start of next release
end = i
break
if line.endswith(release): # Start of the release
start = i + 3 # Skip the header lines
assert start and end and end > start
print("".join(lines[start:end]))