(version: string)
| 197 | * body. Returns null when the section is missing so the caller can fall back |
| 198 | * to GitHub's auto-generated notes. */ |
| 199 | const changelogSectionForVersion = async (version: string): Promise<string | null> => { |
| 200 | const changelogPath = resolve(cliRoot, "CHANGELOG.md"); |
| 201 | if (!existsSync(changelogPath)) return null; |
| 202 | const lines = (await readFile(changelogPath, "utf8")).split("\n"); |
| 203 | const start = lines.findIndex((line) => line.trim() === `## ${version}`); |
| 204 | if (start === -1) return null; |
| 205 | let end = lines.length; |
| 206 | for (let i = start + 1; i < lines.length; i += 1) { |
| 207 | if (/^## /.test(lines[i] ?? "")) { |
| 208 | end = i; |
| 209 | break; |
| 210 | } |
| 211 | } |
| 212 | const body = lines |
| 213 | .slice(start + 1, end) |
| 214 | .join("\n") |
| 215 | .trim(); |
| 216 | return body.length > 0 ? body : null; |
| 217 | }; |
| 218 | |
| 219 | const syncGitHubRelease = async (input: { |
| 220 | readonly tag: string; |
no test coverage detected