MCPcopy Create free account
hub / github.com/dmno-dev/bumpy / formatReleasePlanComment

Function formatReleasePlanComment

packages/bumpy/src/commands/ci.ts:1320–1451  ·  view source on GitHub ↗
(
  plan: ReleasePlan,
  bumpFiles: BumpFile[],
  prNumber: string,
  prBranch: string | null,
  pm: PackageManager,
  warnings: string[] = [],
  parseErrors: string[] = [],
  emptyBumpFileIds: string[] = [],
  channel: ResolvedChannel | null = null,
  allChannels: Map<string, ResolvedChannel> | null = null,
)

Source from the content-addressed store, hash-verified

1318}
1319
1320export function formatReleasePlanComment(
1321 plan: ReleasePlan,
1322 bumpFiles: BumpFile[],
1323 prNumber: string,
1324 prBranch: string | null,
1325 pm: PackageManager,
1326 warnings: string[] = [],
1327 parseErrors: string[] = [],
1328 emptyBumpFileIds: string[] = [],
1329 channel: ResolvedChannel | null = null,
1330 allChannels: Map<string, ResolvedChannel> | null = null,
1331): string {
1332 const repo = process.env.GITHUB_REPOSITORY;
1333 const lines: string[] = [];
1334
1335 // When targeting a prerelease channel, the version display carries a wildcard
1336 // `-<preid>.x` suffix (the exact counter is derived from the registry at publish time).
1337 const versionSuffix = channel ? `-${channel.preid}.x` : '';
1338
1339 // Promotion PR: stable-targeted, carrying bump files that already shipped on a
1340 // channel (e.g. `next` → `main`). Merging it ends the cycle and ships stable.
1341 const promotedChannels = channel ? [] : [...new Set(bumpFiles.map((bf) => bf.channel))].filter((c) => c != null);
1342 const channelTag = (name: string) => `\`@${allChannels?.get(name)?.tag ?? name}\``;
1343
1344 const headline = channel
1345 ? `**This PR targets the \`${channel.name}\` prerelease channel** — merging it ships these packages as a **prerelease** to the \`@${channel.tag}\` dist-tag, not a stable release.`
1346 : promotedChannels.length > 0
1347 ? `**This PR promotes the ${promotedChannels.map((c) => `\`${c}\``).join(', ')} prerelease cycle${promotedChannels.length > 1 ? 's' : ''} to a stable release.** ` +
1348 `The changes below that already shipped to the ${promotedChannels.map(channelTag).join(', ')} dist-tag${promotedChannels.length > 1 ? 's' : ''} will be consolidated into the next stable version bump.`
1349 : '**The changes in this PR will be included in the next version bump.**';
1350 const preamble = [
1351 `<a href="https://bumpy.varlock.dev"><img src="${FROG_IMG_BASE}/frog-clipboard.png" alt="bumpy-frog" width="60" align="left" style="image-rendering: pixelated;" title="Hi! I'm bumpy!" /></a>`,
1352 '',
1353 headline,
1354 '<br clear="left" />',
1355 ].join('\n');
1356 lines.push(preamble);
1357 lines.push('');
1358
1359 // Package list grouped by bump type
1360 const groups: Record<string, PlannedRelease[]> = { major: [], minor: [], patch: [] };
1361 for (const r of plan.releases) {
1362 groups[r.type]?.push(r);
1363 }
1364
1365 for (const type of ['major', 'minor', 'patch'] as const) {
1366 const releases = groups[type];
1367 if (!releases || releases.length === 0) continue;
1368
1369 lines.push(bumpSectionHeader(type));
1370 lines.push('');
1371 for (const r of releases) {
1372 const suffix = r.isDependencyBump ? ' _(dep)_' : r.isCascadeBump ? ' _(cascade)_' : '';
1373 lines.push(`- \`${r.name}\` ${r.oldVersion} → **${r.newVersion}${versionSuffix}**${suffix}`);
1374 }
1375 lines.push('');
1376 }
1377

Callers 2

ciCheckCommandFunction · 0.85

Calls 5

bumpSectionHeaderFunction · 0.85
channelTagFunction · 0.85
sha256HexFunction · 0.85
buildAddBumpFileLinkFunction · 0.85
pmRunCommandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…