From cfb660b02d6cde2c5c333c35e7175de3effdbf6d Mon Sep 17 00:00:00 2001 From: showxu <10173746+showxu@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:49:21 +0800 Subject: [PATCH] Reuse release proposal automatic merge across synchronization retries --- scripts/release_publication.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/release_publication.py b/scripts/release_publication.py index dd5129b..6138fa4 100644 --- a/scripts/release_publication.py +++ b/scripts/release_publication.py @@ -126,7 +126,11 @@ def synchronize(): gh("pr", "edit", number, "--title", title, "--body", body) else: number = gh("pr", "create", "--head", BRANCH, "--base", "master", "--title", title, "--body", body).rsplit("/", 1)[-1] - gh("pr", "merge", number, "--auto", "--squash", "--match-head-commit", commit) + proposal = json.loads(gh("pr", "view", number, "--json", "state,headRefOid,autoMergeRequest")) + if proposal["headRefOid"] != commit: + raise ValueError("Release proposal identity changed") + if proposal["state"] == "OPEN" and proposal["autoMergeRequest"] is None: + gh("pr", "merge", number, "--auto", "--squash", "--match-head-commit", commit) deadline = time.monotonic() + 1200 while time.monotonic() < deadline: proposal = json.loads(gh("pr", "view", number, "--json", "state,headRefOid"))