Skip to content

Commit d8ef90e

Browse files
hsbtclaude
andcommitted
Verify PR is unreleased by merge commit SHA after gh search
`gh search prs` associates a PR with commits left in its history by force-pushes, so a stale commit on master can still surface a PR whose merge commit is already on the stable branch. Re-check each candidate's merge commit SHA against the cherry-pick footer set before treating it as a backport target. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 850eef9 commit d8ef90e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tool/release.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,12 @@ def scan_unreleased_pull_requests(ids)
394394
pulls = []
395395
ids.each do |id|
396396
pull = gh_client.pull_request("ruby/rubygems", id)
397-
pulls << pull if pull.merged_at
397+
next unless pull.merged_at
398+
# `gh search prs` can associate a PR with commits left behind by
399+
# force-pushes that no longer match the merged HEAD. Confirm the PR is
400+
# actually unreleased by comparing its merge commit SHA directly.
401+
next if @level == :patch && released_commit_shas.include?(pull.merge_commit_sha)
402+
pulls << pull
398403
end
399404
pulls
400405
end

0 commit comments

Comments
 (0)