( prNumber: string, body: string, rootDir: string, marker: string = COMMENT_MARKER, )
| 1715 | } else if (r.isCascadeBump) { |
| 1716 | lines.push('- Version bump via cascade rule'); |
| 1717 | } |
| 1718 | |
| 1719 | lines.push(''); |
| 1720 | } |
| 1721 | } |
| 1722 | |
| 1723 | if (showNoPatWarning) { |
| 1724 | lines.push( |
| 1725 | '> ⚠️ `BUMPY_GH_TOKEN` is not set — CI checks will not run automatically on this PR. Run `bumpy ci setup` for help.', |
| 1726 | ); |
| 1727 | lines.push(''); |
| 1728 | } |
| 1729 | |
| 1730 | return lines.join('\n'); |
| 1731 | }; |
| 1732 | |
| 1733 | const full = render(true); |
| 1734 | if (full.length <= GH_BODY_SAFE) return full; |
| 1735 | |
| 1736 | // Too long for GitHub — drop the inline change summaries and keep just the |
| 1737 | // version-bump list. This is rare (dozens of packages or huge changelogs). |
| 1738 | const compact = render(false); |
| 1739 | if (compact.length <= GH_BODY_SAFE) return compact; |
| 1740 | |
| 1741 | // Still too long (an enormous number of packages) — hard-truncate. |
| 1742 | const notice = '\n\n> ⚠️ This release list was truncated because it exceeds GitHub’s size limit.'; |
| 1743 | return compact.slice(0, GH_BODY_MAX - notice.length) + notice; |
| 1744 | } |
| 1745 | |
| 1746 | const COMMENT_MARKER = '<!-- bumpy-release-plan -->'; |
| 1747 | const SNAPSHOT_COMMENT_MARKER = '<!-- bumpy-snapshot -->'; |
| 1748 | |
| 1749 | async function postOrUpdatePrComment( |
| 1750 | prNumber: string, |
| 1751 | body: string, |
| 1752 | rootDir: string, |
| 1753 | marker: string = COMMENT_MARKER, |
| 1754 | ): Promise<void> { |
| 1755 | const validPr = validatePrNumber(prNumber); |
| 1756 | const markedBody = `${marker}\n${body}`; |
| 1757 | |
| 1758 | try { |
| 1759 | // Find existing bumpy comment using gh with jq. The marker keeps each kind of comment |
| 1760 | // (release plan vs snapshot) independent, so they don't overwrite each other. |
| 1761 | const jqFilter = `.comments[] | select(.body | startswith("${marker}")) | .url | capture("issuecomment-(?<id>[0-9]+)$") | .id`; |
| 1762 | const existingComment = tryRunArgs(['gh', 'pr', 'view', validPr, '--json', 'comments', '--jq', jqFilter], { |
| 1763 | cwd: rootDir, |
| 1764 | }); |
| 1765 | |
| 1766 | // Take the first result if multiple |
no test coverage detected
searching dependent graphs…