From c7592e240a0a23b0adae271a65fc18cdabcd5577 Mon Sep 17 00:00:00 2001 From: tignear Date: Tue, 27 Oct 2026 05:54:28 +0900 Subject: [PATCH] ci: coalesce outdated pull request title checks Queue status edits can create many redundant title workflows while runners are busy. Keep only the latest request for each PR, preserving validation on edits and isolating merge-group checks by head SHA. Validated with 25 focused title and queue policy tests and actionlint. Change-Id: I733818ef4a026e62ecef6eec7bfaa56717450442 --- .github/workflows/pr-title.yml | 6 ++++++ scripts/check-pr-title.test.mjs | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 1ea1124d822..8df2453d6c1 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -5,6 +5,12 @@ on: types: [opened, edited, synchronize, reopened] merge_group: +# Keep only the newest request for each PR, including queue-description edits. +# Still validate every surviving event: skipping edits could mask a failed check. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.merge_group.head_sha || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request_target' }} + permissions: contents: read pull-requests: read diff --git a/scripts/check-pr-title.test.mjs b/scripts/check-pr-title.test.mjs index 56d768de485..45a29d864d0 100644 --- a/scripts/check-pr-title.test.mjs +++ b/scripts/check-pr-title.test.mjs @@ -57,3 +57,12 @@ test("guards the repository setting that exposes the title to release automation /Revalidate merge group release impact\n\s+if: github\.event_name == 'merge_group' && github\.event\.merge_group\.base_ref == format\('refs\/heads\/\{0\}', github\.event\.repository\.default_branch\)[\s\S]*MERGE_GROUP_BASE_REF:[\s\S]*MERGE_GROUP_HEAD_REF:[\s\S]*MERGE_GROUP_SHA:[\s\S]*run: node scripts\/check-pr-release-impact\.mjs/, ); }); + +test("title requests coalesce per PR without skipping edit validation", () => { + const workflow = readFileSync(new URL("../.github/workflows/pr-title.yml", import.meta.url), "utf8"); + assert.match(workflow, /types: \[opened, edited, synchronize, reopened\]/); + assert.match(workflow, /group: \$\{\{ github.workflow \}\}-\$\{\{ github.event_name \}\}-\$\{\{ github.event.pull_request.number \|\| github.event.merge_group.head_sha \|\| github.run_id \}\}/); + assert.match(workflow, /cancel-in-progress: \$\{\{ github.event_name == 'pull_request_target' \}\}/); + assert.doesNotMatch(workflow, /github.event.action != 'edited'|queue: max/); + assert.match(workflow, /github.event.pull_request.state == 'open'/); +});