Update version_branch.yml
This commit is contained in:
11
.github/workflows/version_branch.yml
vendored
11
.github/workflows/version_branch.yml
vendored
@@ -160,13 +160,16 @@ jobs:
|
|||||||
text.insert(idx + 1, '- Placeholder TODO item\n')
|
text.insert(idx + 1, '- Placeholder TODO item\n')
|
||||||
j = idx + 2
|
j = idx + 2
|
||||||
|
|
||||||
if j < len(text) and h2_re.match(text[j]):
|
# Do not duplicate the same version H2
|
||||||
print('[INFO] TODO block already followed by an H2. No action taken.')
|
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)
|
raise SystemExit(0)
|
||||||
|
|
||||||
|
# Always insert the new version between TODO section and existing version entries
|
||||||
stamp = datetime.now(timezone.utc).strftime('%Y-%m-%d')
|
stamp = datetime.now(timezone.utc).strftime('%Y-%m-%d')
|
||||||
insert = "\n## [{}] {}\n".format(new_version, stamp)
|
insert = chr(10) + "## [" + new_version + "] " + stamp + chr(10)
|
||||||
print('[INFO] Inserting initial H2 after TODO block')
|
print('[INFO] Inserting version H2 after TODO block')
|
||||||
|
|
||||||
text.insert(j, insert)
|
text.insert(j, insert)
|
||||||
p.write_text(''.join(text), encoding='utf-8')
|
p.write_text(''.join(text), encoding='utf-8')
|
||||||
|
|||||||
Reference in New Issue
Block a user