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

Function formatNoBumpFilesComment

packages/bumpy/src/commands/ci.ts:1519–1590  ·  view source on GitHub ↗
(
  prBranch: string | null,
  pm: PackageManager,
  willFail = false,
  changedPackages: string[] = [],
)

Source from the content-addressed store, hash-verified

1517 * In `--no-fail` mode the check passes, so the friendlier wording is accurate.
1518 */
1519export function formatNoBumpFilesComment(
1520 prBranch: string | null,
1521 pm: PackageManager,
1522 willFail = false,
1523 changedPackages: string[] = [],
1524): string {
1525 const runCmd = pmRunCommand(pm);
1526 const addLink = buildAddBumpFileLink(prBranch);
1527 const emptyLink = buildAddEmptyBumpFileLink(prBranch);
1528
1529 if (!willFail) {
1530 const lines = [
1531 `<a href="https://bumpy.varlock.dev"><img src="${FROG_IMG_BASE}/frog-warning.png" alt="bumpy-frog" width="60" align="left" style="image-rendering: pixelated;" title="Hi! I'm bumpy!" /></a>`,
1532 '',
1533 "Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. **If these changes should result in a version bump, you need to add a bump file.**",
1534 '<br clear="left" />\n',
1535 'You can add a bump file by running:\n',
1536 '```bash',
1537 `${runCmd} add`,
1538 '```',
1539 ];
1540 if (addLink) {
1541 lines.push('');
1542 lines.push(`Or [click here to add a bump file](${addLink}) directly on GitHub.`);
1543 }
1544 lines.push('\n---');
1545 lines.push(`_This comment is maintained by [bumpy](https://bumpy.varlock.dev)._`);
1546 return lines.join('\n');
1547 }
1548
1549 // Failing case — the wording matches the failing status check.
1550 const headline =
1551 changedPackages.length > 0
1552 ? `**This PR changes ${changedPackages.length} package${changedPackages.length === 1 ? '' : 's'} but has no bump file, so this check is failing.**`
1553 : '**This PR has no bump file, so this check is failing.**';
1554 const lines = [
1555 `<a href="https://bumpy.varlock.dev"><img src="${FROG_IMG_BASE}/frog-error.png" alt="bumpy-frog" width="60" align="left" style="image-rendering: pixelated;" title="Hi! I'm bumpy!" /></a>`,
1556 '',
1557 headline,
1558 '<br clear="left" />\n',
1559 ];
1560
1561 if (changedPackages.length > 0) {
1562 lines.push('Changed package(s) without a bump file:\n');
1563 for (const name of changedPackages) {
1564 lines.push(`- \`${name}\``);
1565 }
1566 lines.push('');
1567 }
1568
1569 lines.push(
1570 '**If these changes should be released**, add a bump file describing the version bump. ' +
1571 '**If no release is needed** (e.g. a dependency-only or dev-only change), add an _empty_ ' +
1572 'bump file to acknowledge that intent — that satisfies this check without bumping any package.\n',
1573 );
1574 lines.push('```bash');
1575 lines.push(`${runCmd} add # describe a release`);
1576 lines.push(`${runCmd} add --empty # acknowledge no release is needed`);

Callers 2

ciCheckCommandFunction · 0.85

Calls 3

pmRunCommandFunction · 0.85
buildAddBumpFileLinkFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…