Skip to content

Commit 422d8da

Browse files
authored
fix: keep all of a PR's changesets in the release PR summary (#4031)
## Summary The auto-generated changeset release PR (`changeset-release/main`) builds its `## Improvements` / `## Bug fixes` summary with `scripts/enhance-release-pr.mjs`. The script deduplicated summary entries by PR number, so when a single PR shipped more than one changeset, only the first entry survived and the rest were silently dropped from the summary. The dropped entries still appeared in the raw `<details>` block, which is how the mismatch surfaced (for example in [#3998](#3998), where one PR's four changesets showed up as a single summary line). ## Fix Deduplicate on the full entry text rather than the bare PR number. The entry text embeds the PR link, so: - the same changeset rendered once per package section still collapses to one, - distinct changesets from the same PR are each kept, - identical descriptions from different PRs stay separate. Verified against the raw changeset output from [#3998](#3998): that PR's changesets went from 1 to all 4 in the generated summary.
1 parent 2fa84ea commit 422d8da

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

scripts/enhance-release-pr.mjs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ function parsePrBody(body) {
3535
const entries = [];
3636
if (!body) return entries;
3737

38-
// Deduplicate by PR number
38+
// Deduplicate by entry content. A single changeset that targets multiple
39+
// packages is rendered once per package section, so the same text repeats and
40+
// we collapse it. But several distinct changesets from one PR have distinct
41+
// text (and each still carries that PR's link), so keying on content keeps
42+
// them all instead of dropping every entry after the first for that PR.
3943
const seen = new Set();
40-
const prPattern = /\[#(\d+)\]\(([^)]+)\)/;
4144

4245
// A standalone dependency-bump list item, e.g. "`@trigger.dev/core@4.5.0-rc.7`"
4346
// or "trigger.dev@4.5.0-rc.7". These normally appear nested under
@@ -87,20 +90,19 @@ function parsePrBody(body) {
8790
if (headLine.startsWith("Updated dependencies")) continue;
8891
if (depBumpPattern.test(headLine)) continue;
8992

90-
// Deduplicate by PR number (the changeset link lives on the head line)
91-
const prMatch = itemLines[0].match(prPattern);
92-
if (prMatch) {
93-
const prNumber = prMatch[1];
94-
if (seen.has(prNumber)) continue;
95-
seen.add(prNumber);
96-
}
97-
9893
// Reconstruct the full item: head line + dedented continuation lines, so
9994
// code blocks and sub-bullets survive. Continuation under a "- " item is
10095
// indented 4 spaces; strip up to 4 to bring it back to the base level.
10196
const continuation = itemLines.slice(1).map((l) => l.replace(/^ {1,4}/, ""));
10297
const text = [headLine, ...continuation].join("\n").replace(/\s+$/, "");
10398

99+
// Deduplicate on the full entry text (which embeds the PR link). The same
100+
// changeset echoed across package sections collapses to one, while multiple
101+
// distinct changesets from a single PR are each preserved.
102+
const dedupeKey = text.replace(/\s+/g, " ").trim();
103+
if (seen.has(dedupeKey)) continue;
104+
seen.add(dedupeKey);
105+
104106
// Categorize off the head line
105107
const lower = headLine.toLowerCase();
106108
let type = "improvement";

0 commit comments

Comments
 (0)