Skip to content

Commit dd5b161

Browse files
committed
fix: keep all of a PR's changesets in the release PR summary
The changeset release PR summary deduplicated entries by PR number, so a PR that ships more than one changeset had every entry after the first dropped from the summary (they stayed only in the raw output). Key the dedup on entry content instead, which keeps distinct changesets from the same PR while still collapsing one changeset repeated across package sections.
1 parent bb92935 commit dd5b161

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)