diff --git a/.github/scripts/test_desktop_swift_ci_contract.py b/.github/scripts/test_desktop_swift_ci_contract.py index f12ebf2f3e1..9b94c84d5f1 100755 --- a/.github/scripts/test_desktop_swift_ci_contract.py +++ b/.github/scripts/test_desktop_swift_ci_contract.py @@ -149,6 +149,8 @@ def test_closed_prs_release_the_same_pr_concurrency_group_without_allocating_a_r changes = self.jobs["changes"] self.assertRegex(workflow, r"types:\s*\[[^]]*closed[^]]*\]") + self.assertIn("github.event.action == 'closed' && github.event.pull_request.merged", workflow) + self.assertIn("format('merged-{0}', github.event.pull_request.number)", workflow) self.assertIn("github.event.pull_request.number || github.sha", workflow) self.assertIn( "cancel-in-progress: ${{ github.event_name == 'pull_request' && (github.event.action != 'closed' || !github.event.pull_request.merged) }}", @@ -255,7 +257,7 @@ def test_later_main_push_cannot_cancel_exact_sha_release_evidence(self): # push gets an immutable group and therefore runs its own exact-SHA # Build & Tests and Release Compile checks to a terminal conclusion. self.assertIn( - "group: desktop-swift-${{ github.event.pull_request.number || github.sha }}", + "group: desktop-swift-${{ (github.event.action == 'closed' && github.event.pull_request.merged && format('merged-{0}', github.event.pull_request.number)) || github.event.pull_request.number || github.sha }}", concurrency, ) self.assertIn( diff --git a/.github/workflows/desktop-swift-ci.yml b/.github/workflows/desktop-swift-ci.yml index ed19428a49f..2ac82198427 100644 --- a/.github/workflows/desktop-swift-ci.yml +++ b/.github/workflows/desktop-swift-ci.yml @@ -10,7 +10,7 @@ on: concurrency: # Supersede stale revisions of the same PR, but never let a later main push # cancel the exact-SHA evidence consumed by desktop release planning. - group: desktop-swift-${{ github.event.pull_request.number || github.sha }} + group: desktop-swift-${{ (github.event.action == 'closed' && github.event.pull_request.merged && format('merged-{0}', github.event.pull_request.number)) || github.event.pull_request.number || github.sha }} # An abandoned PR's `closed` run may cancel obsolete work. A merged PR's # bookkeeping run must not cancel exact-SHA evidence still finishing for the # merge, so only unmerged closures retain cancellation authority.