From 2c9776216b1709cad6ebf3d5c811a2a57f287bcc Mon Sep 17 00:00:00 2001 From: Jonathan Miller <230051081+jmiller-moko@users.noreply.github.com> Date: Tue, 16 Dec 2025 17:32:38 -0600 Subject: [PATCH] Update version_branch.yml --- .github/workflows/version_branch.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/version_branch.yml b/.github/workflows/version_branch.yml index 9767a55..fb868de 100644 --- a/.github/workflows/version_branch.yml +++ b/.github/workflows/version_branch.yml @@ -160,13 +160,16 @@ jobs: text.insert(idx + 1, '- Placeholder TODO item\n') j = idx + 2 - if j < len(text) and h2_re.match(text[j]): - print('[INFO] TODO block already followed by an H2. No action taken.') + # Do not duplicate the same version H2 + target_prefix = "## [" + new_version + "] " + if any(line.strip().startswith(target_prefix) for line in text): + print('[INFO] Version H2 already present. No action taken.') raise SystemExit(0) + # Always insert the new version between TODO section and existing version entries stamp = datetime.now(timezone.utc).strftime('%Y-%m-%d') - insert = "\n## [{}] {}\n".format(new_version, stamp) - print('[INFO] Inserting initial H2 after TODO block') + insert = chr(10) + "## [" + new_version + "] " + stamp + chr(10) + print('[INFO] Inserting version H2 after TODO block') text.insert(j, insert) p.write_text(''.join(text), encoding='utf-8')