From 9eed1d1cbd2d741578cd326eabce62ba3ec4567f Mon Sep 17 00:00:00 2001 From: Yaron Kaikov Date: Wed, 6 Nov 2024 22:51:48 +0200 Subject: [PATCH] .github/scripts/auto-backport.py: update method to get closed prs `commit.get_pulls()` in PyGithub returns pull requests that are directly associated with the given commit Since in closed PR. the relevant commit is an event type, the backport automation didn't get the PR info for backporting Ref: https://github.com/scylladb/scylladb/issues/18973 Closes scylladb/scylladb#21468 (cherry picked from commit ef104b7b9605eca48688ff87d81345320131136a) Closes scylladb/scylladb#21483 --- .github/scripts/auto-backport.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/auto-backport.py b/.github/scripts/auto-backport.py index e05c468371..d0b255fcc4 100755 --- a/.github/scripts/auto-backport.py +++ b/.github/scripts/auto-backport.py @@ -150,7 +150,10 @@ def main(): start_commit, end_commit = args.commits.split('..') commits = repo.compare(start_commit, end_commit).commits for commit in commits: - for pr in commit.get_pulls(): + match = re.search(rf"Closes .*#([0-9]+)", commit.commit.message, re.IGNORECASE) + if match: + pr_number = int(match.group(1)) + pr = repo.get_pull(pr_number) closed_prs.append(pr) if args.pull_request: start_commit = args.head_commit