diff --git a/scripts/ci/release-only-diff.mjs b/scripts/ci/release-only-diff.mjs index 57e43761ea..5b4b44ce7f 100644 --- a/scripts/ci/release-only-diff.mjs +++ b/scripts/ci/release-only-diff.mjs @@ -42,7 +42,7 @@ export function classify(paths, before, after) { if (bumped === null) other.push(path); else versions.set(path, bumped); } - return { releaseOnly: paths.length > 0 && other.length === 0, other, versions }; + return { releaseOnly: versions.size > 0 && other.length === 0, other, versions }; } /** The commits in `commits` ({ sha, subject }) that release notes should list but do not link. */ diff --git a/scripts/ci/release-only-diff.test.mjs b/scripts/ci/release-only-diff.test.mjs index 2c659e4e63..3926f2e2e1 100644 --- a/scripts/ci/release-only-diff.test.mjs +++ b/scripts/ci/release-only-diff.test.mjs @@ -213,6 +213,19 @@ test("the merge queue runs the release checks on a release diff", () => { assert.match(ci, /release-checks:[\s\S]*merge_group[\s\S]*release_diff/); }); +// fails without the fix: a fix to an earlier release's notes counted as a release, so its checks wanted a bump. +test("a diff of only release notes and the changelog is a notes fix, not a release", () => { + const files = { "releases/v1.2.3.md": "# old", "docs/changelog.mdx": "old" }; + const after = { "releases/v1.2.3.md": "# new", "docs/changelog.mdx": "new" }; + const result = classify( + Object.keys(files), + (p) => files[p] ?? null, + (p) => after[p] ?? null, + ); + assert.equal(result.releaseOnly, false); + assert.equal(result.versions.size, 0); +}); + test("classify works on plain data", () => { const files = { "a/package.json": manifest("1"), "plugin.json": manifest("1") }; const after = { "a/package.json": manifest("2"), "plugin.json": manifest("2") };