mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 23:08:14 +00:00
28 lines
695 B
Python
28 lines
695 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import os
|
||
|
import re
|
||
|
|
||
|
LINK_RE = re.compile(r"\[#(\d+)\]")
|
||
|
ISSUE_URL = "https://github.com/trezor/python-trezor/issues/"
|
||
|
|
||
|
CHANGELOG = os.path.dirname(__file__) + "/../CHANGELOG.md"
|
||
|
|
||
|
changelog_entries = set()
|
||
|
result_lines = []
|
||
|
|
||
|
with open(CHANGELOG, "r+") as changelog:
|
||
|
for line in changelog:
|
||
|
if ISSUE_URL in line:
|
||
|
break
|
||
|
for n in LINK_RE.findall(line):
|
||
|
changelog_entries.add(int(n))
|
||
|
result_lines.append(line)
|
||
|
|
||
|
changelog.seek(0)
|
||
|
changelog.truncate(0)
|
||
|
for line in result_lines:
|
||
|
changelog.write(line)
|
||
|
for issue in sorted(changelog_entries):
|
||
|
changelog.write(f"[#{issue}]: {ISSUE_URL}{issue}\n")
|