Selaa lähdekoodia

fix(docs): skip the version section when no released notes remain on next

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 2 päivää sitten
vanhempi
sitoutus
468a19a5bc
1 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 7 2
      scripts/release_upgrade_notes.py

+ 7 - 2
scripts/release_upgrade_notes.py

@@ -106,6 +106,7 @@ def move_released_notes(version: str, released_lines: list[str], target_lines: l
         return None
         return None
 
 
     result = list(preamble)
     result = list(preamble)
+    moved = False
     for section in sections:
     for section in sections:
         if section_heading(section) != UNRELEASED_HEADING:
         if section_heading(section) != UNRELEASED_HEADING:
             result.extend(section)
             result.extend(section)
@@ -113,12 +114,16 @@ def move_released_notes(version: str, released_lines: list[str], target_lines: l
 
 
         heading, notes = split_sections(section, "=== ")
         heading, notes = split_sections(section, "=== ")
         shipped = [note for note in notes if note_key(note) in keys]
         shipped = [note for note in notes if note_key(note) in keys]
-        remaining = [note for note in notes if note_key(note) not in keys]
+        if not shipped:
+            result.extend(section)
+            continue
 
 
+        remaining = [note for note in notes if note_key(note) not in keys]
         result.extend(build_unreleased_section(heading, remaining))
         result.extend(build_unreleased_section(heading, remaining))
         result.extend(build_version_section(version, shipped))
         result.extend(build_version_section(version, shipped))
+        moved = True
 
 
-    return result
+    return result if moved else None
 
 
 
 
 def main(argv: list[str]) -> int:
 def main(argv: list[str]) -> int: