docs: update changelog, nicer output for script (#2811)

This commit is contained in:
Henry Schreiner
2021-01-21 11:34:39 -05:00
committed by GitHub
parent 44105ca1f2
commit 08bca374fd
2 changed files with 100 additions and 18 deletions

View File

@@ -3,7 +3,10 @@
import re
import ghapi.core
import ghapi.all
from rich import print
from rich.syntax import Syntax
ENTRY = re.compile(
@@ -19,8 +22,10 @@ ENTRY = re.compile(
re.DOTALL | re.VERBOSE,
)
print()
api = ghapi.core.GhApi(owner="pybind", repo="pybind11")
api = ghapi.all.GhApi(owner="pybind", repo="pybind11")
issues = api.issues.list_for_repo(labels="needs changelog", state="closed")
missing = []
@@ -34,17 +39,25 @@ for issue in issues:
if not msg.endswith("."):
msg += "."
print(msg)
print(f" `#{issue.number} <{issue.html_url}>`_\n")
msg += f"\n `#{issue.number} <{issue.html_url}>`_"
print(Syntax(msg, "rst", theme="ansi_light"))
print()
else:
missing.append(issue)
if missing:
print()
print("-" * 30)
print("[blue]" + "-" * 30)
print()
for issue in missing:
print(f"Missing: {issue.title}")
print(f" {issue.html_url}")
print(f"[red bold]Missing:[/red bold][red] {issue.title}")
print(f"[red] {issue.html_url}\n")
print("[bold]Template:\n")
msg = "## Suggested changelog entry:\n\n```rst\n\n```"
print(Syntax(msg, "md", theme="ansi_light"))
print()