diff options
author | Laura Flores <lflores@redhat.com> | 2023-05-05 20:31:53 +0200 |
---|---|---|
committer | Laura Flores <lflores@redhat.com> | 2023-05-05 20:31:53 +0200 |
commit | c20d876c69ec1748d2207d38fbcf31ecbf66c00d (patch) | |
tree | 0949ee1a8ffc444ea62d3d704d39181b8e7e2e7d /src/script/ceph-release-notes | |
parent | script: handle a corner case for author in cherry-picked PRs (diff) | |
download | ceph-c20d876c69ec1748d2207d38fbcf31ecbf66c00d.tar.xz ceph-c20d876c69ec1748d2207d38fbcf31ecbf66c00d.zip |
script: improve author scraping on cherry picks
Signed-off-by: Laura Flores <lflores@redhat.com>
Diffstat (limited to '')
-rwxr-xr-x | src/script/ceph-release-notes | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index 1c01154f090..366588d64a0 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -192,8 +192,15 @@ def make_release_notes(gh, repo, ref, cherry_picks, plaintext, html, markdown, v else: print(f"Could not fetch PR {number} in {retries} tries.") raise + commit = None + if merges[number] == "cherry_pick": + try: + commit = repo.commit(pr['merge_commit_sha']) + except: + pass if merges[number] == "merge_commit": commit = merge_commits[number] + if commit: (title, message) = _title_message(commit, pr, strict) else: (title, message) = (pr['title'], pr['body']) @@ -204,7 +211,7 @@ def make_release_notes(gh, repo, ref, cherry_picks, plaintext, html, markdown, v ) authors = {} - if merges[number] == "merge_commit": + if commit: for c in repo.iter_commits( "{sha1}^1..{sha1}^2".format(sha1=commit.hexsha) ): @@ -224,7 +231,7 @@ def make_release_notes(gh, repo, ref, cherry_picks, plaintext, html, markdown, v if authors: author = ", ".join(authors.keys()) else: - if merges[number] == "merge_commit": + if commit: author = commit.parents[-1].author.name else: author = pr['user']['login'] |