Merge pull request #25416 from drfloob/import-script-support-for-github-squash-and-merge

Teach the release notes script to find GitHub Squash and Merge PRs
pull/25439/head
Adam J Heller 4 years ago committed by GitHub
commit 79399461de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      tools/release/release_notes.py

@ -83,15 +83,15 @@ API_URL = 'https://api.github.com/repos/grpc/grpc/pulls/'
def get_commit_log(prevRelLabel, relBranch):
"""Return the output of 'git log --pretty=online --merges prevRelLabel..relBranch' """
"""Return the output of 'git log prevRelLabel..relBranch' """
import subprocess
print("Running git log --pretty=oneline --merges " + prevRelLabel + ".." +
relBranch)
return subprocess.check_output([
"git", "log", "--pretty=oneline", "--merges",
glg_command = [
"git", "log", "--pretty=oneline", "--committer=GitHub",
"%s..%s" % (prevRelLabel, relBranch)
])
]
print("Running ", " ".join(glg_command))
return subprocess.check_output(glg_command)
def get_pr_data(pr_num):
@ -120,11 +120,19 @@ def get_pr_data(pr_num):
def get_pr_titles(gitLogs):
import re
error_count = 0
match = b"Merge pull request #(\d+)"
prlist = re.findall(match, gitLogs, re.MULTILINE)
# PRs with merge commits
match_merge_pr = b"Merge pull request #(\d+)"
prlist_merge_pr = re.findall(match_merge_pr, gitLogs, re.MULTILINE)
print("\nPRs matching 'Merge pull request #<num>':")
print(prlist)
print(prlist_merge_pr)
print("\n")
# PRs using Github's squash & merge feature
match_sq = b"\(#(\d+)\)$"
prlist_sq = re.findall(match_sq, gitLogs, re.MULTILINE)
print("\nPRs matching '[PR Description](#<num>)$'")
print(prlist_sq)
print("\n")
prlist = prlist_merge_pr + prlist_sq
langs_pr = defaultdict(list)
for pr_num in prlist:
pr_num = str(pr_num)

Loading…
Cancel
Save