mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
chore: update changelog script for categories (#4942)
This commit is contained in:
parent
e250155afa
commit
b389ae77cb
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -29,6 +30,18 @@ issues_pages = ghapi.page.paged(
|
|||||||
)
|
)
|
||||||
issues = (issue for page in issues_pages for issue in page)
|
issues = (issue for page in issues_pages for issue in page)
|
||||||
missing = []
|
missing = []
|
||||||
|
cats_descr = {
|
||||||
|
"feat": "New Features",
|
||||||
|
"fix": "Bug fixes",
|
||||||
|
"fix(types)": "",
|
||||||
|
"fix(cmake)": "",
|
||||||
|
"docs": "Documentation",
|
||||||
|
"tests": "Tests",
|
||||||
|
"ci": "CI",
|
||||||
|
"chore": "Other",
|
||||||
|
"unknown": "Uncategorised",
|
||||||
|
}
|
||||||
|
cats: dict[str, list[str]] = {c: [] for c in cats_descr}
|
||||||
|
|
||||||
for issue in issues:
|
for issue in issues:
|
||||||
changelog = ENTRY.findall(issue.body or "")
|
changelog = ENTRY.findall(issue.body or "")
|
||||||
@ -36,13 +49,26 @@ for issue in issues:
|
|||||||
missing.append(issue)
|
missing.append(issue)
|
||||||
else:
|
else:
|
||||||
(msg,) = changelog
|
(msg,) = changelog
|
||||||
|
if msg.startswith("- "):
|
||||||
|
msg = msg[2:]
|
||||||
if not msg.startswith("* "):
|
if not msg.startswith("* "):
|
||||||
msg = "* " + msg
|
msg = "* " + msg
|
||||||
if not msg.endswith("."):
|
if not msg.endswith("."):
|
||||||
msg += "."
|
msg += "."
|
||||||
|
|
||||||
msg += f"\n `#{issue.number} <{issue.html_url}>`_"
|
msg += f"\n `#{issue.number} <{issue.html_url}>`_"
|
||||||
|
for cat in cats:
|
||||||
|
if issue.title.lower().startswith(f"{cat}:"):
|
||||||
|
cats[cat].append(msg)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
cats["unknown"].append(msg)
|
||||||
|
|
||||||
|
for cat, msgs in cats.items():
|
||||||
|
if msgs:
|
||||||
|
desc = cats_descr[cat]
|
||||||
|
print(f"[bold]{desc}:\n" if desc else "")
|
||||||
|
for msg in msgs:
|
||||||
print(Syntax(msg, "rst", theme="ansi_light", word_wrap=True))
|
print(Syntax(msg, "rst", theme="ansi_light", word_wrap=True))
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user