()
| 221 | } |
| 222 | |
| 223 | async function main() { |
| 224 | log(`🔍 Generating release notes for ${owner}/${repo} @ ${currentTag}...`); |
| 225 | |
| 226 | const prevTag = flags.fromTag || (await getPreviousTag()); |
| 227 | if (!prevTag) { |
| 228 | console.error("No previous tag found. Use --from-tag to specify one."); |
| 229 | process.exit(1); |
| 230 | } |
| 231 | |
| 232 | const commits = await getCommits(prevTag, currentTag); |
| 233 | if (!commits.length) { |
| 234 | console.error("No commits found."); |
| 235 | process.exit(1); |
| 236 | } |
| 237 | const categorized = categorizeCommits(commits, flags); |
| 238 | let output; |
| 239 | |
| 240 | if (flags.format === "json") { |
| 241 | output = formatJSON(currentTag, prevTag, categorized); |
| 242 | } else { |
| 243 | output = formatMarkdown(currentTag, prevTag, categorized, flags); |
| 244 | } |
| 245 | |
| 246 | process.stdout.write(output + "\n"); |
| 247 | } |
| 248 | |
| 249 | main().catch((err) => console.error(err)); |
no test coverage detected