Skip to content

Commit

Permalink
Skip first release entry
Browse files Browse the repository at this point in the history
From suggested edit by @mvdbeek
  • Loading branch information
jdavcs committed Feb 20, 2024
1 parent f9cae9d commit 8fe906e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions galaxy_release_util/point_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ def read_package(package_path: pathlib.Path) -> Package:


def parse_changelog(package: Package) -> List[ChangelogItem]:

def append_change(changes, child):
if (rawsource := child.rawsource.strip()) and not rawsource.startswith("First release"):
changes.append(f"* {rawsource}")

settings = frontend.get_default_settings(Parser) # type: ignore[attr-defined] ## upstream type stubs not updated?
document = utils.new_document(str(package.history_rst), settings)
Parser().parse(package.history_rst.read_text(), document)
Expand Down Expand Up @@ -164,7 +169,7 @@ def parse_changelog(package: Package) -> List[ChangelogItem]:
# could be bullet list or a nested section with bugfix, docs, etc
if changelog_item.tagname == "bullet_list":
for child in changelog_item.children:
changes.append(f"* {child.rawsource.strip()}")
append_change(changes, child)
elif changelog_item.tagname == "paragraph":
changes = changelog_item.rawsource.splitlines()
elif changelog_item.tagname == "section":
Expand All @@ -173,7 +178,7 @@ def parse_changelog(package: Package) -> List[ChangelogItem]:
changes.append(f"\n{section_delimiter}\n{kind}\n{section_delimiter}\n")
for section_changelog_item in changelog_item[1:]:
for child in section_changelog_item:
changes.append(f"* {child.rawsource.strip()}")
append_change(changes, child)
changelog_items.append(ChangelogItem(version=current_version, date=current_date, changes=changes))

# Filter out dev release versions without changelog,
Expand Down

0 comments on commit 8fe906e

Please sign in to comment.