|
1 | 1 | #!/usr/bin/python3 |
2 | 2 | """ |
3 | 3 | 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. |
4 | 8 | """ |
5 | 9 |
|
6 | 10 | import shlex |
@@ -89,6 +93,13 @@ def commit_linkify(commitid: str, repo: str) -> str: |
89 | 93 | return f"[`{commitid}`](https://github.com/ActivityWatch/{repo}/commit/{commitid})" |
90 | 94 |
|
91 | 95 |
|
| 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 | + |
92 | 103 | def summary_repo(path: str, commitrange: str, filter_types: List[str]) -> str: |
93 | 104 | if commitrange.endswith("0000000"): |
94 | 105 | # Happens when a submodule has been removed |
@@ -117,14 +128,13 @@ def summary_repo(path: str, commitrange: str, filter_types: List[str]) -> str: |
117 | 128 |
|
118 | 129 | for name, entries in (("✨ Features", feats), ("🐛 Fixes", fixes), ("🔨 Misc", misc)): |
119 | 130 | 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) |
122 | 135 | 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 |
128 | 138 |
|
129 | 139 | # NOTE: For now, these TODOs can be manually fixed for each changelog. |
130 | 140 | # 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: |
152 | 162 |
|
153 | 163 |
|
154 | 164 | 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" |
156 | 167 | output = summary_repo( |
157 | 168 | ".", commitrange=f"{prev_release}...master", filter_types=filter_types |
158 | 169 | ) |
|
0 commit comments