Skip to content

Commit b7ec40b

Browse files
authored
fix: recognise alpha release commits (#279)
Node.js 27 introduces Alpha releases versioned as vN.0.0-alpha.X.Y.Z, with release commits titled "YYYY-MM-DD, Version 27.0.0-alpha.0.0.0 (Alpha)" and "Working on v27.0.0-alpha.0.0.1". Treat them as release commits so they are filtered out of generated changelogs. Refs: nodejs/Release#1187 Signed-off-by: RafaelGSS <[email protected]>
1 parent 73a602f commit b7ec40b

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

‎groups.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ It doesn't cover false positives though.
3030
*/
3131

3232
export function isReleaseCommit (summary) {
33-
return /^Working on v?\d{1,2}\.\d{1,3}\.\d{1,3}$/.test(summary) ||
34-
/^\d{4}-\d{2}-\d{2},? (Node\.js|Version) v?\d{1,2}\.\d{1,3}\.\d{1,3} (["'][A-Za-z ]+["'] )?\((Current|Stable|LTS|Maintenance)\)/.test(summary) ||
33+
return /^Working on v?\d{1,2}\.\d{1,3}\.\d{1,3}(-alpha\.\d{1,3}\.\d{1,3}\.\d{1,3})?$/.test(summary) ||
34+
/^\d{4}-\d{2}-\d{2},? (Node\.js|Version) v?\d{1,2}\.\d{1,3}\.\d{1,3}(-alpha\.\d{1,3}\.\d{1,3}\.\d{1,3})? (["'][A-Za-z ]+["'] )?\((Current|Stable|LTS|Maintenance|Alpha)\)/.test(summary) ||
3535
/^\d{4}-\d{2}-\d{2},? io.js v\d{1,2}\.\d{1,3}\.\d{1,3} Release/.test(summary) ||
3636
/^\d+\.\d+\.\d+$/.test(summary) // `npm version X` style commit
3737
}

‎test.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { execSync } from 'child_process'
66
import assert from 'node:assert/strict'
77
import { test } from 'node:test'
88
import { styleText } from 'node:util'
9+
import { isReleaseCommit } from './groups.js'
910

1011
const __dirname = dirname(new URL(import.meta.url).pathname)
1112

@@ -165,3 +166,20 @@ test('test plaintext, CVE-ID', () => {
165166
* (CVE-2024-22020) add cveId support to commmit output (RafaelGSS) https://github.com/nodejs/node/pull/55819
166167
`)
167168
})
169+
170+
test('test isReleaseCommit, Alpha', () => {
171+
assert.equal(isReleaseCommit('2026-10-20, Version 27.0.0-alpha.0.0.0 (Alpha)'), true)
172+
assert.equal(isReleaseCommit('2026-11-03, Version 27.0.0-alpha.1.2.3 (Alpha)'), true)
173+
assert.equal(isReleaseCommit('Working on v27.0.0-alpha.0.0.1'), true)
174+
assert.equal(isReleaseCommit('Working on 27.0.0-alpha.1.2.3'), true)
175+
})
176+
177+
test('test isReleaseCommit, non-release commits', () => {
178+
assert.equal(isReleaseCommit('2026-10-20, Version 27.0.0-beta.0.0.0 (Alpha)'), false)
179+
assert.equal(isReleaseCommit('2026-10-20, Version 27.0.0-alpha.0.0.0 (Beta)'), false)
180+
assert.equal(isReleaseCommit('Working on v27.0.0-beta.0.0.1'), false)
181+
assert.equal(isReleaseCommit('Working on v27.0.0-alpha.0.0'), false)
182+
assert.equal(isReleaseCommit('Working on v27.0.0-alpha.0.0.1 and more'), false)
183+
assert.equal(isReleaseCommit('doc: add 27.0.0-alpha.0.0.0 to changelog'), false)
184+
assert.equal(isReleaseCommit('feature: refactor and improve --commit-url'), false)
185+
})

0 commit comments

Comments
 (0)