Add asserts to make sure wiki is always updated

This commit is contained in:
Ayaz Salikhov
2023-11-07 14:37:39 +01:00
parent 716683512e
commit 49150068fc

View File

@@ -18,6 +18,7 @@ def update_home_wiki_page(wiki_dir: Path, month: str) -> None:
wiki_home_content = wiki_home_file.read_text()
month_line = f"| [`{month}`](./{month}) |\n"
if month_line not in wiki_home_content:
assert TABLE_BEGINNING in wiki_home_content
wiki_home_content = wiki_home_content.replace(
TABLE_BEGINNING, TABLE_BEGINNING + month_line
)
@@ -39,7 +40,9 @@ def update_monthly_wiki_page(
monthly_page.write_text(MONTHLY_PAGE_HEADER)
LOGGER.info(f"Created monthly page: {monthly_page.relative_to(wiki_dir)}")
monthly_page_content = monthly_page.read_text().replace(
monthly_page_content = monthly_page.read_text()
assert MONTHLY_PAGE_HEADER in monthly_page_content
monthly_page_content = monthly_page_content.replace(
MONTHLY_PAGE_HEADER, MONTHLY_PAGE_HEADER + build_history_line + "\n"
)
monthly_page.write_text(monthly_page_content)