Skip to content

Commit

Permalink
Add check if changelog description even exists
Browse files Browse the repository at this point in the history
Add TODO
  • Loading branch information
philnewm committed Nov 23, 2024
1 parent 7cb85e0 commit 7b81089
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/conversion_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def get_changelog_description(pr_body: str, changelog_desc: str ="## Changelog D
changelog_section = None
description_lines: list[str] = []

# TODO add early return in case changelog_desc was not found

for line in lines:
if line.startswith(changelog_desc):
changelog_section = True
Expand All @@ -146,9 +148,11 @@ def get_changelog_description(pr_body: str, changelog_desc: str ="## Changelog D
if changelog_section:
description_lines.append(line.strip())

for index in [0, -1]:
if not description_lines[index]:
description_lines.pop(index)

if description_lines:
for index in [0, -1]:
if not description_lines[index]:
description_lines.pop(index)

return description_lines

Expand Down

0 comments on commit 7b81089

Please sign in to comment.