This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new 792b37c1ab4 [SPARK-45031][INFRA] Choose the right merge code path and merge hash for reopened PRs 792b37c1ab4 is described below commit 792b37c1ab4658b81f2e5f06d28e438af53988fb Author: Kent Yao <y...@apache.org> AuthorDate: Mon Sep 4 14:45:45 2023 -0700 [SPARK-45031][INFRA] Choose the right merge code path and merge hash for reopened PRs ### What changes were proposed in this pull request? When determining to cherry-pick a PR, we also check the PR is in the closed state; Otherwise, we assume it gets reverted and reopened, and we go normal merging. When cherry-picking, we shall select the merge hash from the latest commit-close event instead of the oldest. This is a bug fix ### Why are the changes needed? Bugfix ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? mutually ### Was this patch authored or co-authored using generative AI tooling? no Closes #42749 from yaooqinn/SPARK-45031. Authored-by: Kent Yao <y...@apache.org> Signed-off-by: Dongjoon Hyun <dh...@apple.com> --- dev/merge_spark_pr.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py index 23f5af7daca..4021999f19b 100755 --- a/dev/merge_spark_pr.py +++ b/dev/merge_spark_pr.py @@ -615,8 +615,13 @@ def main(): # Instead, they're closed by committers. merge_commits = [e for e in pr_events if e["event"] == "closed" and e["commit_id"] is not None] - if merge_commits: - merge_hash = merge_commits[0]["commit_id"] + if merge_commits and pr["state"] == "closed": + # A PR might have multiple merge commits, if it's reopened and merged again. We shall + # cherry-pick PRs in closed state with the latest merge hash. + # If the PR is still open(reopened), we shall not cherry-pick it but perform the normal + # merge as it could have been reverted earlier. + merge_commits = sorted(merge_commits, key=lambda x: x["created_at"]) + merge_hash = merge_commits[-1]["commit_id"] message = get_json("%s/commits/%s" % (GITHUB_API_BASE, merge_hash))["commit"]["message"] print("Pull request %s has already been merged, assuming you want to backport" % pr_num) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org