(version: string)
| 172 | * body. Returns null when the section is missing so the caller can fall back |
| 173 | * to GitHub's auto-generated notes. */ |
| 174 | const changelogSectionForVersion = async (version: string): Promise<string | null> => { |
| 175 | const changelogPath = resolve(cliRoot, "CHANGELOG.md"); |
| 176 | if (!existsSync(changelogPath)) return null; |
| 177 | const lines = (await readFile(changelogPath, "utf8")).split("\n"); |
| 178 | const start = lines.findIndex((line) => line.trim() === `## ${version}`); |
| 179 | if (start === -1) return null; |
| 180 | let end = lines.length; |
| 181 | for (let i = start + 1; i < lines.length; i += 1) { |
| 182 | if (/^## /.test(lines[i] ?? "")) { |
| 183 | end = i; |
| 184 | break; |
| 185 | } |
| 186 | } |
| 187 | const body = lines |
| 188 | .slice(start + 1, end) |
| 189 | .join("\n") |
| 190 | .trim(); |
| 191 | return body.length > 0 ? body : null; |
| 192 | }; |
| 193 | |
| 194 | const syncGitHubRelease = async (input: { |
| 195 | readonly tag: string; |
no test coverage detected