Skip to content

Commit 4cd3a79

Browse files
committed
fix: improved changelog script
1 parent 63b73db commit 4cd3a79

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

scripts/build_changelog.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/python3
22
"""
33
Script that outputs a changelog for the repository in the current directory and its submodules.
4+
5+
Manual actions needed to clean up for changelog:
6+
- Reorder modules in a logical order (aw-webui, aw-server, aw-server-rust, aw-watcher-window, aw-watcher-afk, ...)
7+
- Add the "bundle repo" notice to the main ActivityWatch repo.
48
"""
59

610
import shlex
@@ -89,6 +93,13 @@ def commit_linkify(commitid: str, repo: str) -> str:
8993
return f"[`{commitid}`](https://github.com/ActivityWatch/{repo}/commit/{commitid})"
9094

9195

96+
def wrap_details(title, body):
97+
out = f"\n\n<details><summary><b>{title}</b></summary>\n<p>\n"
98+
out += body
99+
out += "\n\n</p></details>"
100+
return out
101+
102+
92103
def summary_repo(path: str, commitrange: str, filter_types: List[str]) -> str:
93104
if commitrange.endswith("0000000"):
94105
# Happens when a submodule has been removed
@@ -117,14 +128,13 @@ def summary_repo(path: str, commitrange: str, filter_types: List[str]) -> str:
117128

118129
for name, entries in (("✨ Features", feats), ("🐛 Fixes", fixes), ("🔨 Misc", misc)):
119130
if entries:
120-
if "Misc" in name:
121-
header = f"\n\n<details><summary><b>{name}</b></summary>\n<p>\n"
131+
_count = len(entries.strip().split("\n"))
132+
title = f"{name} ({_count})"
133+
if "Misc" in name or "Fixes" in name:
134+
out += wrap_details(title, entries)
122135
else:
123-
header = f"\n\n#### {name}"
124-
out += header
125-
out += entries
126-
if "Misc" in name:
127-
out += "\n\n</p></details>"
136+
out += f"\n\n#### {title}"
137+
out += entries
128138

129139
# NOTE: For now, these TODOs can be manually fixed for each changelog.
130140
# TODO: Fix issue where subsubmodules can appear twice (like aw-webui)
@@ -152,7 +162,8 @@ def summary_repo(path: str, commitrange: str, filter_types: List[str]) -> str:
152162

153163

154164
def build(filter_types=["build", "ci", "tests"]):
155-
prev_release = run("git describe --tags --abbrev=0").strip()
165+
# prev_release = run("git describe --tags --abbrev=0").strip()
166+
prev_release = "v0.9.2"
156167
output = summary_repo(
157168
".", commitrange=f"{prev_release}...master", filter_types=filter_types
158169
)

0 commit comments

Comments
 (0)