Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.4.0] Simplify release notes by just printing the first line of the commit … #19448

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions scripts/release/relnotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ def git(*args):
list(args)).decode("utf-8").strip().split("\n")


def extract_relnotes(commit_message_lines, is_major_release):
def extract_pr_title(commit_message_lines):
"""Extracts first line from commit message (passed in as a list of lines)."""
return re.sub(
r"\[\d+\.\d+\.\d\]\s?", "", commit_message_lines[0].strip()
)


def extract_relnotes(commit_message_lines):
"""Extracts relnotes from a commit message (passed in as a list of lines)."""
relnote_lines = []
in_relnote = False
Expand All @@ -45,18 +52,7 @@ def extract_relnotes(commit_message_lines, is_major_release):
relnote = " ".join(relnote_lines)
relnote_lower = relnote.strip().lower().rstrip(".")
if relnote_lower == "n/a" or relnote_lower == "none" or not relnote_lower:
if is_major_release:
return None
relnote = re.sub(
r"\[\d+\.\d+\.\d\]\s?", "", commit_message_lines[0].strip()
)
else:
issue_id = re.search(
r"\(\#[0-9]+\)$", commit_message_lines[0].strip().split()[-1]
)
if issue_id:
relnote = relnote + " " + issue_id.group(0).strip()

return None
return relnote


Expand All @@ -78,7 +74,9 @@ def get_relnotes_between(base, head, is_major_release):
rolled_back_commits.add(m[1])
# The rollback commit itself is also skipped.
continue
relnote = extract_relnotes(lines, is_major_release)
relnote = (
extract_relnotes(lines) if is_major_release else extract_pr_title(lines)
)
if relnote is not None:
relnotes.append(relnote)
return relnotes
Expand Down