Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed May 28, 2024
1 parent ecb8848 commit ec58837
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scripts/release-note.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,21 @@ def extract_release_contents(target: str, cur_tag: str, prev_tag: str) -> str:
start_pos = document.find(start_marker)

if start_pos == -1:
raise ValueError(f"Start marker for tag '{cur_tag}' not found in the document.")
raise ValueError(f"Start marker for tag '{cur_tag}' not found in {target}.")

start_pos += len(start_marker) + len("YYYY-MM-DD")
end_marker = f"## [{prev_tag}]" if prev_tag else "<!-- Release links -->"

if prev_tag:
end_marker = f"## [{prev_tag}]"
end_pos = document.find(end_marker, start_pos)
if end_pos == -1:
raise ValueError(
f"End marker for previous tag '{prev_tag}' not found in the document."
f"End marker for previous tag '{prev_tag}' not found in {target}."
)
else:
end_pos = document.find("<!-- Release links -->", start_pos)
end_pos = document.find(end_marker, start_pos)
if end_pos == -1:
raise ValueError(
"End marker '<!-- Release links -->' not found in the document."
)
raise ValueError(f"End marker '{end_marker}' not found in {target}.")

return document[start_pos:end_pos].strip()

Expand Down

0 comments on commit ec58837

Please sign in to comment.