8000 Simplify release notes by just printing the first line of the commit … · coderabbit-test/bazel@d2e8b7e · GitHub
[go: up one dir, main page]

Skip to content

Commit d2e8b7e

Browse files
keertkcopybara-github
authored andcommitted
Simplify release notes by just printing the first line of the commit (usually the PR title) for minor and patch releases instead of looking for the "relnotes:" marker
PiperOrigin-RevId: 555265560 Change-Id: I5fae2ce763bef6d9b989212a8f3aba66777fb561
1 parent 37268de commit d2e8b7e

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

scripts/release/relnotes.py

Lines changed: 12 additions & 14 deletions
C3B0
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ def git(*args):
2626
list(args)).decode("utf-8").strip().split("\n")
2727

2828

29-
def extract_relnotes(commit_message_lines, is_major_release):
29+
def extract_pr_title(commit_message_lines):
30+
"""Extracts first line from commit message (passed in as a list of lines)."""
31+
return re.sub(
32+
r"\[\d+\.\d+\.\d\]\s?", "", commit_message_lines[0].strip()
33+
)
34+
35+
36+
def extract_relnotes(commit_message_lines):
3037
"""Extracts relnotes from a commit message (passed in as a list of lines)."""
3138
relnote_lines = []
3239
in_relnote = False
@@ -45,18 +52,7 @@ def extract_relnotes(commit_message_lines, is_major_release):
4552
relnote = " ".join(relnote_lines)
4653
relnote_lower = relnote.strip().lower().rstrip(".")
4754
if relnote_lower == "n/a" or relnote_lower == "none" or not relnote_lower:
48-
if is_major_release:
49-
return None
50-
relnote = re.sub(
51-
r"\[\d+\.\d+\.\d\]\s?", "", commit_message_lines[0].strip()
52-
)
53-
else:
54-
issue_id = re.search(
55-
r"\(\#[0-9]+\)$", commit_message_lines[0].strip().split()[-1]
56-
)
57-
if issue_id:
58-
relnote = relnote + " " + issue_id.group(0).strip()
59-
55+
return None
6056
return relnote
6157

6258

@@ -78,7 +74,9 @@ def get_relnotes_between(base, head, is_major_release):
7874
rolled_back_commits.add(m[1])
7975
# The rollback commit itself is also skipped.
8076
continue
81-
relnote = extract_relnotes(lines, is_major_release)
77+
relnote = (
78+
extract_relnotes(lines) if is_major_release else extract_pr_title(lines)
79+
)
8280
if relnote is not None:
8381
relnotes.append(relnote)
8482
return relnotes

0 commit comments

Comments
 (0)
0