From a57cc8b0c05c1fa0121cdc0321e7ae75c82d05a5 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Wed, 9 Aug 2023 17:41:06 +0200 Subject: [PATCH] Fix missing related PRs when cherry-picking (#33261) The `airflow-github` tooling had a check if PR has been already merged, but the PR did not work well when there was already a PR cherry-picked that referred the PR in question in their log message. The check was done via `git log --grep=#PR` essentially and so it happenes that `--grep` matches not only the first line of the message but the whole log message. So if the log message contained reference to the cherry-picked PR it was seen as merged. This change adds ( ) around and $ to the regexp to match not only the PR number but also parentheses around. (cherry picked from commit eb07618d29ce957ef4401a98f25449a23d0135ad) --- dev/airflow-github | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/airflow-github b/dev/airflow-github index 33e543a77f3b..115ed48d1916 100755 --- a/dev/airflow-github +++ b/dev/airflow-github @@ -96,7 +96,7 @@ def get_commit_in_main_associated_with_pr(repo: git.Repo, issue: Issue) -> str | def is_cherrypicked(repo: git.Repo, issue: Issue, previous_version: str | None = None) -> bool: """Check if a given issue is cherry-picked in the current branch or not""" - log_args = ["--format=%H", f"--grep=#{issue.number}"] + log_args = ["--format=%H", f"--grep=(#{issue.number})$"] if previous_version: log_args.append(previous_version + "..") log = repo.git.log(*log_args)