Skip to content

Commit 209a746

Browse files
committed
Group build manifests by year
1 parent 2ba3651 commit 209a746

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

tagging/update_wiki.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,36 @@
1010

1111

1212
def update_home_wiki_page(wiki_dir: Path, year_month: str) -> None:
13-
TABLE_BEGINNING = """\
13+
YEAR_MONTHLY_TABLES = "<!-- YEAR_MONTHLY_TABLES -->\n"
14+
15+
TABLE_HEADER = """\
1416
| Month |
1517
| ---------------------- |
1618
"""
19+
1720
wiki_home_file = wiki_dir / "Home.md"
1821
wiki_home_content = wiki_home_file.read_text()
22+
23+
year = year_month[:4]
24+
year_header = f"## {year}\n"
25+
if year_header not in wiki_home_content:
26+
assert YEAR_MONTHLY_TABLES in wiki_home_content
27+
wiki_home_content = wiki_home_content.replace(
28+
YEAR_MONTHLY_TABLES,
29+
YEAR_MONTHLY_TABLES + f"\n{year_header}\n{TABLE_HEADER}",
30+
)
31+
LOGGER.info(f"Updated wiki home page with year header for year: {year}")
32+
1933
year_month_line = f"| [`{year_month}`](./{year_month}) |\n"
2034
if year_month_line not in wiki_home_content:
21-
assert TABLE_BEGINNING in wiki_home_content
35+
assert TABLE_HEADER in wiki_home_content
2236
wiki_home_content = wiki_home_content.replace(
23-
TABLE_BEGINNING, TABLE_BEGINNING + year_month_line
37+
TABLE_HEADER, TABLE_HEADER + year_month_line
2438
)
25-
wiki_home_file.write_text(wiki_home_content)
2639
LOGGER.info(f"Updated wiki home page with month: {year_month}")
2740

41+
wiki_home_file.write_text(wiki_home_content)
42+
2843

2944
def update_monthly_wiki_page(
3045
wiki_dir: Path, year_month: str, build_history_line: str

0 commit comments

Comments
 (0)