.github/scripts/label_promoted_commits.py: only match the Close tag in the last line in the commit message

When a backport PR is promoted to the release branch, we automatically close the backport PR (since GitHub will only close the one based on the default branch) and update the labels in the original PRs

In a situation when we have multiple `closes` prefixes, the script will use the first one (which is not the correct one), see 3ddb61c90e

Fixing this by always using the last line with the `closes` prefix

Closes scylladb/scylladb#21498
This commit is contained in:
Yaron Kaikov
2024-11-08 11:42:32 +02:00
committed by Botond Dénes
parent 381faa2649
commit cc71077e33

View File

@@ -54,7 +54,8 @@ def main():
# Print commit information
for commit in commits:
print(f'Commit sha is: {commit.sha}')
match = pr_pattern.search(commit.commit.message)
pr_last_line = commit.commit.message.splitlines()[-1]
match = pr_pattern.search(pr_last_line)
if match:
pr_number = int(match.group(1))
if pr_number in processed_prs: