(
commits: list[CommitRow], base_ref: str, head_ref: str
)
| 536 | |
| 537 | |
| 538 | def render_markdown( |
| 539 | commits: list[CommitRow], base_ref: str, head_ref: str |
| 540 | ) -> str: |
| 541 | lines = [ |
| 542 | '# Release Notes\n\n', |
| 543 | f'- Range: `{base_ref}..{head_ref}`\n', |
| 544 | f'- Commits: {len(commits)}\n\n', |
| 545 | ] |
| 546 | |
| 547 | categories = ordered_values( |
| 548 | (commit.category for commit in commits), PR_CATEGORIES |
| 549 | ) |
| 550 | for category in categories: |
| 551 | lines.append(f'## {category}\n\n') |
| 552 | category_commits = [ |
| 553 | commit for commit in commits if commit.category == category |
| 554 | ] |
| 555 | topics = ordered_values( |
| 556 | (commit.topic for commit in category_commits), PR_TYPES |
| 557 | ) |
| 558 | for topic in topics: |
| 559 | topic_commits = [ |
| 560 | commit for commit in category_commits if commit.topic == topic |
| 561 | ] |
| 562 | if not topic_commits: |
| 563 | continue |
| 564 | lines.append(f'### {topic}\n\n') |
| 565 | for commit in topic_commits: |
| 566 | lines.append( |
| 567 | f'- {markdown_entry_text(commit)} ({get_hash_or_pr_url(commit)})\n' |
| 568 | ) |
| 569 | lines.append('\n') |
| 570 | return ''.join(lines) |
| 571 | |
| 572 | |
| 573 | def render_category_markdown(category: str, commits: list[CommitRow]) -> str: |
nothing calls this directly
no test coverage detected