commit 887a1d0810a55479a16fc5cbca99d0a6dad8bd49
parent fc381a6cdee215f7e8db6f71a123df9b21de2066
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Mon, 4 May 2026 21:09:33 +0530
Refactor regex for updating README.md commits section
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/scripts/update_commits.py b/.github/scripts/update_commits.py
@@ -55,10 +55,10 @@ def update_readme(commits):
with open('README.md', 'r', encoding='utf-8') as f:
readme = f.read()
- # Use regex to replace everything between the HTML comments
+ # Use regex to replace the tags and everything in between them
updated_readme = re.sub(
- r"(?<=<!-- START_RECENT_COMMITS -->\n).*?(?=\n<!-- END_RECENT_COMMITS -->)",
- commit_list_md,
+ r"<!-- START_RECENT_COMMITS -->.*?<!-- END_RECENT_COMMITS -->",
+ f"<!-- START_RECENT_COMMITS -->\n{commit_list_md}\n<!-- END_RECENT_COMMITS -->",
readme,
flags=re.DOTALL
)