[SOT] Add a "Commits with missing PR number" section in the release note draft (#35658)

This adds the commit info (author, title, link to commit, link to CL) for the commits that are missing the PR number to the release note draft.

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #35658

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35658 from yijiem:fix-release-note-script 7254e4f7de
PiperOrigin-RevId: 601539726
pull/35656/head
Yijie Ma 12 months ago committed by Copybara-Service
parent ab795b0adc
commit 7b0eb3be03
  1. 51
      tools/release/release_notes.py

@ -88,18 +88,8 @@ HTML_URL = "https://github.com/grpc/grpc/pull/"
API_URL = "https://api.github.com/repos/grpc/grpc/pulls/"
def print_commits_wo_pr(commits_wo_pr):
def get_commit_detail(commit):
"""Print commit and CL info for the commits that are submitted with CL-first workflow and warn the release manager to check manually."""
print("***WARNING***")
print(
"The following commits are submitted with the CL-first workflow and does not have a PR number available in its commit info!"
)
print(
"Release manager needs to use the following info to go to the CL and gets the PR info from the Copybara:copybara_presubmit info on the CL and manually verify if the PR has the `release notes: yes` label!"
)
print("\n")
for commit in commits_wo_pr:
glg_command = [
"git",
"log",
@ -107,14 +97,23 @@ def print_commits_wo_pr(commits_wo_pr):
"%s" % commit,
]
output = subprocess.check_output(glg_command).decode("utf-8", "ignore")
matches = re.search("Author:.*<(.*@).*>", output)
author = matches.group(1)
detail = "- " + author + " "
title = output.splitlines()[4].strip()
detail += "- " + title
if not title.endswith("."):
detail += "."
matches = re.search("PiperOrigin-RevId: ([0-9]+)$", output)
print("Commit: https://github.com/grpc/grpc/commit/%s" % commit)
print(
"CL: https://critique.corp.google.com/cl/%s" % matches.group(1)
cl_num = matches.group(1)
detail += (
" ([commit](https://github.com/grpc/grpc/commit/"
+ commit
+ ")) ([CL](https://critique.corp.google.com/cl/"
+ cl_num
+ "))"
)
print("\n")
print("***WARNING***")
return detail
def get_commit_log(prevRelLabel, relBranch):
@ -231,18 +230,26 @@ def get_pr_titles(gitLogs):
)
langs_pr["inrel"].append(detail)
langs_pr[lang].append(prline)
# Warn the release manager to manually check the commits that do not have PR
# info in its commit message.
commits_wo_pr = all_commits_set - merge_commits_set - sq_commits_set
if commits_wo_pr:
print_commits_wo_pr(commits_wo_pr)
for commit in commits_wo_pr:
langs_pr["nopr"].append(get_commit_detail(commit))
return langs_pr, error_count
def write_draft(langs_pr, file, version, date):
file.write(content_header.format(version=version, date=date))
file.write(
"Commits with missing PR number - please lookup the PR info in the corresponding CL and add to the additional notes if necessary.\n"
)
file.write("---\n")
file.write("\n")
if langs_pr["nopr"]:
file.write("\n".join(langs_pr["nopr"]))
else:
file.write("- None")
file.write("\n")
file.write("\n")
file.write("PRs with missing release notes label - please fix in Github\n")
file.write("---\n")
file.write("\n")

Loading…
Cancel
Save