diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8df8bb0..2319a79 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -14,6 +14,15 @@ updates: groups: npm-minor-and-patch: update-types: [minor, patch] + # react and react-dom serve only the e2e fixture test/fixtures/pages/react-list.html, + # which is a React 18 app on purpose (React 18's UMD builds load without a bundler; + # React 19 has none). React 19 coverage is a second fixture of its own (SCR-464), so + # these stay on 18.x and get its patches. + ignore: + - dependency-name: react + update-types: ["version-update:semver-major"] + - dependency-name: react-dom + update-types: ["version-update:semver-major"] # The docs site (slice 44) has its own package.json and lockfile. - package-ecosystem: npm directory: /site diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs index 36331c2..44d6630 100755 --- a/scripts/release-notes.mjs +++ b/scripts/release-notes.mjs @@ -66,6 +66,16 @@ export function checkChangelog(text, version) { "(they're the plain-language notes learners read) in the release PR, then tag.", ); } + // A pull request merged with a merge commit reaches release-please twice: as its commit, + // and as the merge commit, whose body is the PR's title. When the two read the same, the + // entry is listed twice (with different hashes); keep one in the release PR. + const seen = new Set(); + for (const line of section.split("\n")) { + const entry = /^\* (.+?)(?: \(\[[0-9a-f]{7,40}\]\([^)]*\)\))?$/.exec(line.trim())?.[1]; + if (!entry) continue; + if (seen.has(entry)) problems.push(`The ${version} section lists "${entry}" more than once. Keep one in the release PR.`); + seen.add(entry); + } if (/^#{2,4} .*BREAKING CHANGES/m.test(section) && !/^#{2,4} Upgrade notes\b/im.test(section)) { problems.push( `The ${version} section has breaking changes but no "### Upgrade notes" (what changed, who is affected, the steps; slice 30 ยง11).`, diff --git a/test/unit/release-notes.test.mjs b/test/unit/release-notes.test.mjs index 64c5ed6..ae9e56c 100644 --- a/test/unit/release-notes.test.mjs +++ b/test/unit/release-notes.test.mjs @@ -63,6 +63,18 @@ test("tagging is refused without a section, with leftovers under Unreleased, or assert.match(checkChangelog(RELEASED, "v0.3.0")[0], /isn't a release version/); }); +test("tagging is refused while an entry is listed twice (a PR's commit and its merge commit)", () => { + const twice = RELEASED.replace( + "* **extension:** bulk add ([ff493a9](https://github.com/ScriptKittyOS/kotiko/commit/ff493a9))", + "* **extension:** bulk add ([ff493a9](https://github.com/ScriptKittyOS/kotiko/commit/ff493a9))\n" + + "* **extension:** bulk add ([1234abc](https://github.com/ScriptKittyOS/kotiko/commit/1234abc))", + ); + const problems = checkChangelog(twice, "0.3.0"); + assert.equal(problems.length, 1); + assert.match(problems[0], /lists "\*\*extension:\*\* bulk add" more than once/); + assert.deepEqual(checkChangelog(RELEASED, "0.3.0"), [], "one of each passes"); +}); + test("release candidates are tagged before their CHANGELOG section exists", () => { assert.deepEqual(checkChangelog("# Changelog\n\n## Unreleased\n\n- wip\n", "0.3.0-rc.1"), []); });