chore: make README update idempotent
Prevent CI from re-introducing duplicate Curated Collections sections by normalizing headers and de-duping inserts.
This commit is contained in:
@@ -122,10 +122,6 @@ The repository is organized into several key areas of expertise:
|
|||||||
|
|
||||||
[Check out our Starter Packs in docs/BUNDLES.md](docs/BUNDLES.md) to find the perfect toolkit for your role.
|
[Check out our Starter Packs in docs/BUNDLES.md](docs/BUNDLES.md) to find the perfect toolkit for your role.
|
||||||
|
|
||||||
## 📦 Curated Collections
|
|
||||||
|
|
||||||
[Check out our Starter Packs in docs/BUNDLES.md](docs/BUNDLES.md) to find the perfect toolkit for your role.
|
|
||||||
|
|
||||||
## Full Skill Registry (256/256)
|
## Full Skill Registry (256/256)
|
||||||
|
|
||||||
> [!NOTE] > **Document Skills**: We provide both **community** and **official Anthropic** versions for DOCX, PDF, PPTX, and XLSX. Locally, the official versions are used by default (via symlinks). In the repository, both versions are available for flexibility.
|
> [!NOTE] > **Document Skills**: We provide both **community** and **official Anthropic** versions for DOCX, PDF, PPTX, and XLSX. Locally, the official versions are used by default (via symlinks). In the repository, both versions are available for flexibility.
|
||||||
|
|||||||
@@ -47,13 +47,30 @@ def update_readme():
|
|||||||
content
|
content
|
||||||
)
|
)
|
||||||
|
|
||||||
# 5. Insert Collections / Bundles Section (New in Phase 3)
|
# 5. Ensure Curated Collections section exists (idempotent)
|
||||||
# This logic checks if "## 📦 Curated Collections" exists. If not, it creates it before Full Registry.
|
#
|
||||||
collections_header = "## 📦 Curated Collections"
|
# Historical note: we previously used "## 📦 Curated Collections" in some runs.
|
||||||
|
# If the README already contains "## Curated Collections", inserting the emoji header creates duplicates.
|
||||||
if collections_header not in content:
|
canonical_collections_header = "## Curated Collections"
|
||||||
# Insert before Full Skill Registry
|
canonical_collections_body = "[Check out our Starter Packs in docs/BUNDLES.md](docs/BUNDLES.md) to find the perfect toolkit for your role."
|
||||||
content = content.replace("## Full Skill Registry", f"{collections_header}\n\n[Check out our Starter Packs in docs/BUNDLES.md](docs/BUNDLES.md) to find the perfect toolkit for your role.\n\n## Full Skill Registry")
|
|
||||||
|
# Normalize any emoji variant to the canonical header
|
||||||
|
content = content.replace("## 📦 Curated Collections", canonical_collections_header)
|
||||||
|
|
||||||
|
# If the section is missing entirely, insert it right before the Full Skill Registry section
|
||||||
|
if canonical_collections_header not in content:
|
||||||
|
registry_header_match = re.search(r'^## Full Skill Registry', content, flags=re.MULTILINE)
|
||||||
|
if registry_header_match:
|
||||||
|
insert_block = f"{canonical_collections_header}\n\n{canonical_collections_body}\n\n"
|
||||||
|
content = content[:registry_header_match.start()] + insert_block + content[registry_header_match.start():]
|
||||||
|
|
||||||
|
# De-dupe repeated Curated Collections blocks (e.g. after a previous buggy insert)
|
||||||
|
escaped_body = re.escape(canonical_collections_body)
|
||||||
|
dedupe_pattern = re.compile(
|
||||||
|
rf'(?:{re.escape(canonical_collections_header)}\s*\n\s*\n{escaped_body}\s*\n\s*){{2,}}',
|
||||||
|
flags=re.MULTILINE
|
||||||
|
)
|
||||||
|
content = dedupe_pattern.sub(f"{canonical_collections_header}\n\n{canonical_collections_body}\n\n", content)
|
||||||
|
|
||||||
# 6. Generate New Registry Table
|
# 6. Generate New Registry Table
|
||||||
print("🔄 Generating new registry table...")
|
print("🔄 Generating new registry table...")
|
||||||
|
|||||||
Reference in New Issue
Block a user