Fetch and save a single release changelog.
(tag: str, version: str, prev_tag: str | None = None)
| 507 | |
| 508 | |
| 509 | def _fetch_single_release(tag: str, version: str, prev_tag: str | None = None) -> bool: |
| 510 | """Fetch and save a single release changelog.""" |
| 511 | click.echo(f" Fetching {version}...") |
| 512 | |
| 513 | body = get_release_body(tag) |
| 514 | |
| 515 | if not body and prev_tag: |
| 516 | click.echo(f" No body, generating from {prev_tag}...") |
| 517 | try: |
| 518 | body = generate_release_notes(tag, prev_tag) |
| 519 | except click.ClickException: |
| 520 | body = None |
| 521 | |
| 522 | if not body: |
| 523 | click.secho(f" ✗ Could not get release notes for {tag}", fg="red", err=True) |
| 524 | return False |
| 525 | |
| 526 | date = get_release_date(tag) |
| 527 | content = format_changelog(version, body, date=date) |
| 528 | |
| 529 | filepath = save_changelog(version, content) |
| 530 | click.secho(f" ✓ Saved: {filepath}", fg="green") |
| 531 | return True |
| 532 | |
| 533 | |
| 534 | # ============================================================================= |
no test coverage detected