diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml index 631028806e5..5c2a83ef8ea 100644 --- a/Resources/Changelog/ChangelogSunrise.yml +++ b/Resources/Changelog/ChangelogSunrise.yml @@ -1,4 +1,4 @@ -Entries: +Entries: - author: VigersRay changes: - message: Init @@ -621,38 +621,3 @@ type: Add id: 52 time: '2024-06-12T09:58:33.522024+00:00' -- author: VigersRay - description: "\u041E\u0426\u041A \u0442\u0435\u043F\u0435\u0440\u044C \u0434\u043E\ - \u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0447\ - \u0435\u0440\u0435\u0437 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435\ - \ \u0440\u043E\u043B\u0438 \u0432 \u0434\u0438\u0441\u043A\u043E\u0440\u0434\u0435\ - .\r" - id: 53 - time: '2024-06-12T19:21:11.187491+00:00' - type: tweak -- author: VigersRay - description: "\u041F\u0426\u041A \u0443\u0434\u0430\u043B\u0435\u043D \u0438\u0437\ - \ \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0440\u043E\u043B\u0435\ - \u0439." - id: 54 - time: '2024-06-12T19:21:11.187501+00:00' - type: remove -- author: Odlieerr, Rinary - changes: - - message: "\u0420\u0435\u0441\u043F\u0440\u0430\u0439\u0442 \u043C\u0435\u0434\u0438\ - \u0431\u043E\u0442\u0430, \u0442\u0435\u043F\u0435\u0440\u044C \u043E\u043D\ - \ \u043B\u0435\u0442\u0430\u0435\u0442, \u0438 \u0435\u0433\u043E \u043D\u0435\ - \ \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u043F\u0440\u0438\u043A\u0440\ - \u0443\u0442\u0438\u0442\u044C." - type: Tweak - id: 55 - time: '2024-06-12T19:21:12.110638+00:00' -- author: Rinary - changes: - - message: "\u041C\u0435\u0434\u0411\u043E\u0442 \u0442\u0435\u043F\u0435\u0440\u044C\ - \ \u0438\u043C\u0435\u0435\u0442 \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\ - \u044B\u0435 \u0444\u0440\u0430\u0437\u044B, \u043D\u0430\u0437\u0432\u0430\u043D\ - \u0438\u0435, \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435." - type: Tweak - id: 56 - time: '2024-06-12T19:21:30.691534+00:00' diff --git a/Tools/automatic_changelog.py b/Tools/automatic_changelog.py index 11f639f675d..7e6598ad7e1 100644 --- a/Tools/automatic_changelog.py +++ b/Tools/automatic_changelog.py @@ -32,15 +32,20 @@ def parse_changelog(pr_body: str) -> List[dict]: author = header_match.group(1) - changelog_entries = [] + changes = [] for match in re.finditer(ENTRY_RE, pr_body, re.MULTILINE): - changelog_entries.append({ - 'type': match.group(1), - 'description': match.group(2), - 'author': author + changes.append({ + 'type': match.group(1).capitalize(), + 'message': match.group(2) }) - return changelog_entries + if not changes: + return [] + + return [{ + 'author': author, + 'changes': changes + }] def update_changelog(changelog_file: str, pr_body: str): new_entries = parse_changelog(pr_body) @@ -58,11 +63,11 @@ def update_changelog(changelog_file: str, pr_body: str): max_id = max(map(lambda e: e.get("id", 0), entries_list), default=0) - for entry in new_entries: + for new_entry in new_entries: max_id += 1 - entry["id"] = max_id - entry["time"] = datetime.datetime.now(datetime.timezone.utc).isoformat() - entries_list.append(entry) + new_entry["id"] = max_id + new_entry["time"] = datetime.datetime.now(datetime.timezone.utc).isoformat() + entries_list.append(new_entry) entries_list.sort(key=lambda e: e["id"]) @@ -72,7 +77,7 @@ def update_changelog(changelog_file: str, pr_body: str): new_data = {"Entries": entries_list} with open(changelog_file, "w", encoding="utf-8-sig") as f: - yaml.safe_dump(new_data, f) + yaml.safe_dump(new_data, f, allow_unicode=True) if __name__ == "__main__": if len(sys.argv) != 3: