File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 4141 set -euo pipefail
4242 python3 - <<'PY'
4343 from pathlib import Path
44- import re
4544 import zipfile
4645 import sys
4746
@@ -53,16 +52,21 @@ jobs:
5352 print(f"[ERROR] SKILL.md not found at {skill_md}")
5453 sys.exit(1)
5554
56- text = skill_md.read_text(encoding="utf-8")
57- match = re.match(r"^---\\s*\\n(.*?)\\n---\\s*\\n", text, re.S)
58- if not match:
59- print("[ERROR] Missing YAML frontmatter in SKILL.md")
55+ lines = skill_md.read_text(encoding="utf-8").lstrip("\ufeff").splitlines()
56+ if not lines or lines[0].strip() != "---":
57+ print("[ERROR] Missing YAML frontmatter in SKILL.md (no opening ---)")
58+ sys.exit(1)
59+ try:
60+ end_index = lines.index("---", 1)
61+ except ValueError:
62+ print("[ERROR] Missing YAML frontmatter in SKILL.md (no closing ---)")
6063 sys.exit(1)
6164
62- frontmatter = match.group(1)
63- def get_field(name: str) -> str | None:
64- for line in frontmatter.splitlines():
65- if line.strip().startswith(f"{name}:"):
65+ frontmatter = lines[1:end_index]
66+ def get_field(name: str):
67+ prefix = f"{name}:"
68+ for line in frontmatter:
69+ if line.strip().startswith(prefix):
6670 return line.split(":", 1)[1].strip().strip('"').strip("'")
6771 return None
6872
You can’t perform that action at this time.
0 commit comments