Skip to content

Commit

Permalink
chore: release notes use more paragraphs when needed (#6932)
Browse files Browse the repository at this point in the history
Often PR descriptions end with a colon, followed by a new paragraph
containing a code block. Currently in the release notes these get
dropped. This PR attempts to include them. It's not particularly robust,
but I'll review during the next release.
  • Loading branch information
kim-em authored Feb 3, 2025
1 parent 800c60d commit 838dcc4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions script/release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ def main():
body = full_message[len(first_line):].strip()

paragraphs = body.split('\n\n')
second_paragraph = paragraphs[0] if len(paragraphs) > 0 else ""
description = paragraphs[0] if len(paragraphs) > 0 else ""

# If there's a third paragraph and second ends with colon, include it
if len(paragraphs) > 1 and description.endswith(':'):
description = description + '\n\n' + paragraphs[1]

labels = fetch_pr_labels(pr_number)

Expand All @@ -127,15 +131,15 @@ def main():

report_errors = first_line.startswith("feat:") or first_line.startswith("fix:")

if not second_paragraph.startswith("This PR "):
if not description.startswith("This PR "):
if report_errors:
sys.stderr.write(f"No PR description found in commit:\n{commit_hash}\n{first_line}\n{body}\n\n")
fallback_description = re.sub(r":$", "", first_line.split(" ", 1)[1]).rsplit(" (#", 1)[0]
markdown_description = format_markdown_description(pr_number, fallback_description)
else:
continue
else:
markdown_description = format_markdown_description(pr_number, second_paragraph.replace("This PR ", ""))
markdown_description = format_markdown_description(pr_number, description.replace("This PR ", ""))

changelog_labels = [label for label in labels if label.startswith("changelog-")]
if len(changelog_labels) > 1:
Expand Down

0 comments on commit 838dcc4

Please sign in to comment.