MCPcopy Create free account
hub / github.com/remix-run/react-router / truncateChangelogs

Function truncateChangelogs

scripts/changes/pr.ts:253–283  ·  view source on GitHub ↗
(
  releases: PackageRelease[],
  maxLength: number,
)

Source from the content-addressed store, hash-verified

251}
252
253function truncateChangelogs(
254 releases: PackageRelease[],
255 maxLength: number,
256): string {
257 let lines = ["# Changelogs"];
258 let currentLength = lines.join("\n").length;
259 let includedCount = 0;
260
261 for (let release of releases) {
262 let changelog = "\n\n" + generatePackageChangelog(release);
263 if (currentLength + changelog.length <= maxLength) {
264 lines.push("");
265 lines.push(generatePackageChangelog(release));
266 currentLength += changelog.length;
267 includedCount++;
268 } else {
269 break;
270 }
271 }
272
273 let omittedCount = releases.length - includedCount;
274
275 if (omittedCount > 0) {
276 lines.push("");
277 lines.push(
278 `> ⚠️ ${omittedCount} changelog${omittedCount === 1 ? "" : "s"} omitted due to size limits. See the PR diff for full details.`,
279 );
280 }
281
282 return lines.join("\n");
283}

Callers 1

generatePrBodyFunction · 0.85

Calls 2

generatePackageChangelogFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected