ci: sync readme_md and description from references/README.md with SKILL.md fallback

Made-with: Cursor
This commit is contained in:
2026-04-12 09:10:58 +08:00
parent 4856167682
commit 4b15c6d99c

View File

@@ -76,7 +76,26 @@ jobs:
import frontmatter, os, json, shutil import frontmatter, os, json, shutil
post = frontmatter.load('SKILL.md') post = frontmatter.load('SKILL.md')
metadata = dict(post.metadata or {}) metadata = dict(post.metadata or {})
metadata['readme_md'] = (post.content or '').strip() skill_readme_md = (post.content or '').strip()
skill_description = metadata.get('description')
metadata['readme_md'] = skill_readme_md
readme_path = os.path.join('references', 'README.md')
if os.path.isfile(readme_path):
try:
readme_post = frontmatter.load(readme_path)
body = (readme_post.content or '').strip()
rm_meta = readme_post.metadata or {}
desc = rm_meta.get('description')
if desc is not None and str(desc).strip():
metadata['description'] = str(desc).strip()
if body:
metadata['readme_md'] = body
except Exception:
pass
if not (metadata.get('readme_md') or '').strip():
metadata['readme_md'] = skill_readme_md
if skill_description is not None and not str(metadata.get('description', '') or '').strip():
metadata['description'] = skill_description
openclaw_meta = metadata.get('metadata', {}).get('openclaw', {}) openclaw_meta = metadata.get('metadata', {}).get('openclaw', {})
slug = (openclaw_meta.get('slug') or metadata.get('slug') or metadata.get('name') or '').strip() slug = (openclaw_meta.get('slug') or metadata.get('slug') or metadata.get('name') or '').strip()
if not slug: if not slug: