Branch
Hash :
5a443ade
Author :
Date :
2025-07-29T22:30:33
[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.
#!/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]))