chg: doc: Improve changelog & release notes workflow
Related: #4847 Merge branch '4847-changelog-sorting-and-tweaks' into 'main' See merge request isc-projects/bind9!9300
This commit is contained in:
@@ -1802,6 +1802,13 @@ def versions_data_iter(
|
||||
):
|
||||
continue
|
||||
|
||||
body = body_process(commit.body)
|
||||
|
||||
## Extract gitlab issue number
|
||||
issue = None
|
||||
if match := re.search(r".*:gl:`#([0-9]+)`", body):
|
||||
issue = int(match.group(1))
|
||||
|
||||
matched_section = first_matching(section_regexps, commit.subject)
|
||||
|
||||
## Finally storing the commit in the matching section
|
||||
@@ -1811,11 +1818,21 @@ def versions_data_iter(
|
||||
"author": commit.author_name,
|
||||
"authors": commit.author_names,
|
||||
"subject": subject_process(commit.subject),
|
||||
"body": body_process(commit.body),
|
||||
"body": body,
|
||||
"commit": commit,
|
||||
"issue": issue,
|
||||
}
|
||||
)
|
||||
|
||||
## Sort sections by issue number or title
|
||||
for section_key in sections.keys():
|
||||
sections[section_key].sort(
|
||||
key=lambda c: (
|
||||
c["issue"] if c["issue"] is not None else sys.maxsize,
|
||||
c["subject"],
|
||||
)
|
||||
)
|
||||
|
||||
## Flush current version
|
||||
current_version["sections"] = [
|
||||
{"label": k, "commits": sections[k]} for k in section_order if k in sections
|
||||
@@ -1830,7 +1847,7 @@ def changelog(
|
||||
unreleased_version_label="unreleased",
|
||||
include_commit_sha=False,
|
||||
warn=warn, ## Mostly used for test
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""Returns a string containing the changelog of given repository
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ body_process = (
|
||||
r" :gl:`\3`",
|
||||
)
|
||||
| ReSub(r"\n*Merge branch '[^']+' into [^\n]+", r"")
|
||||
| ReSub(r"\n*See merge request isc-projects/bind9(!\d+)", r" :gl:`\1`")
|
||||
| ReSub(r"\n*See merge request isc-projects/bind9(!\d+)", r"")
|
||||
| Wrap(regexp="\n\n", separator="\n\n")
|
||||
| strip
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user