diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs index 81ee6be658..b333ae2037 100644 --- a/.github/scripts/issue-version-triage.cjs +++ b/.github/scripts/issue-version-triage.cjs @@ -25,7 +25,7 @@ function extractSectionValue(body, heading) { function normalizeVersion(value) { if (!value) return null; - const match = String(value).match(/\bv?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/); + const match = String(value).match(/\bv?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/i); return match ? match[1] : null; } diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs index ad0e7ea31e..7610fa0c17 100644 --- a/.github/scripts/issue-version-triage.test.cjs +++ b/.github/scripts/issue-version-triage.test.cjs @@ -182,3 +182,28 @@ test("postRetestComment skips maintainer-authored issues", async () => { assert.equal(calls.createComment.length, 0); }); + +test("normalizeVersion accepts a capitalised V prefix", () => { + const { normalizeVersion } = triage.internals; + + // Regression: issue #1538 reported "V6.0.4" under the "Pulse version" + // heading and was wrongly labelled needs-version-info. The heading regexes + // are case-insensitive and captured "V6.0.4" correctly, but handed it to a + // case-sensitive normalizeVersion, so every extraction path returned null. + assert.equal(normalizeVersion("V6.0.4"), "6.0.4"); + assert.equal(normalizeVersion("v6.0.4"), "6.0.4"); + assert.equal(normalizeVersion("6.0.4"), "6.0.4"); + assert.equal(normalizeVersion("V6.1.0-rc.4"), "6.1.0-rc.4"); + + assert.equal(normalizeVersion("V6"), null); + assert.equal(normalizeVersion("### Pulse version"), null); +}); + +test("extractPulseVersion reads a capitalised version under its heading", () => { + const { extractPulseVersion } = triage.internals; + + assert.equal( + extractPulseVersion("[Bug]: something broke", "### Pulse version\nV6.0.4\n"), + "6.0.4" + ); +});