Skip to content

Commit

Permalink
Add some comments to the refactored script
Browse files Browse the repository at this point in the history
  • Loading branch information
irismessage committed Dec 14, 2024
1 parent b381f8c commit 199086d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tools/actions_changelogs_since_last_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ def main():
return

if DEBUG:
# to debug this script locally, you can use
# a separate local file as the old changelog
last_changelog_stream = DEBUG_CHANGELOG_FILE_OLD.read_text()
else:
# when running this normally in a GitHub actions workflow,
# it will get the old changelog from the GitHub API
last_changelog_stream = get_last_changelog()

last_changelog = yaml.safe_load(last_changelog_stream)
Expand Down Expand Up @@ -150,6 +154,7 @@ def send_discord_webhook(lines: list[str]):


def changelog_entries_to_message_lines(entries: Iterable[ChangelogEntry]) -> list[str]:
"""Process structured changelog entries into a list of lines making up a formatted message."""
message_lines = []

for contributor_name, group in itertools.groupby(entries, lambda x: x["author"]):
Expand Down Expand Up @@ -179,6 +184,7 @@ def changelog_entries_to_message_lines(entries: Iterable[ChangelogEntry]) -> lis


def send_message_lines(message_lines: list[str]):
"""Join a list of message lines into chunks that are each below Discord's message length limit, and send them."""
chunk_lines = []
chunk_length = 0

Expand Down

0 comments on commit 199086d

Please sign in to comment.