PR校验适配新版authors对象
Some checks failed
Build repo.json / build (18.x) (push) Has been cancelled
Build repo.json / upload (push) Has been cancelled

This commit is contained in:
起个名字好难的喵
2025-07-25 20:24:17 +08:00
parent 846f609bb4
commit 0b0a12d45d

View File

@@ -222,8 +222,10 @@ def ensure_required_fields(info, filename):
corrections.append("type 自动修正为 collect")
if not info["authors"]:
info["authors"] = os.getenv("GITHUB_ACTOR", "未知作者")
corrections.append(f"author 自动设置为 {info['authors']}")
author_name = os.getenv("GITHUB_ACTOR", "未知作者")
author_link = "https://github.com/" + os.getenv("GITHUB_ACTOR", "babalae/bettergi-scripts-list")
info["authors"] = [{"name": author_name, "links": author_link}]
corrections.append(f"authors 自动设置为 {info['authors']}")
return corrections
@@ -435,8 +437,10 @@ def initialize_data(data, file_path):
messages.append(f"⚠️ 文件缺少 type 字段,已设置为默认值: collect")
if "authors" not in info:
info["authors"] = os.getenv("GITHUB_ACTOR", "未知作者")
messages.append(f"⚠️ 文件缺少 author 字段,已设置为: {info['authors']}")
author_name = os.getenv("GITHUB_ACTOR", "未知作者")
author_link = "https://github.com/" + os.getenv("GITHUB_ACTOR", "babalae/bettergi-scripts-list")
info["authors"] = [{"name": author_name, "links": author_link}]
messages.append(f"⚠️ 文件缺少 authors 字段,已设置为: {info['authors']}")
if "version" not in info:
info["version"] = DEFAULT_VERSION