github.com/replit/upm@v0.0.0-20240423230255-9ce4fc3ea24c/scripts/extract-changelog.py (about)

     1  #!/usr/bin/env python3
     2  
     3  lines = []
     4  found_section = False
     5  
     6  with open("CHANGELOG.md") as f:
     7      for line in f:
     8          if line.startswith("## "):
     9              if found_section:
    10                  break
    11              else:
    12                  found_section = True
    13          elif found_section:
    14              lines.append(line)
    15  
    16  while lines and lines[-1].isspace():
    17      lines.pop()
    18  
    19  print("## Changes in this release\n\n", end="")
    20  for line in lines:
    21      print(line, end="")