fix validate
This commit is contained in:
@@ -221,9 +221,9 @@ def ensure_required_fields(info, filename):
|
||||
info["type"] = "collect"
|
||||
corrections.append("type 自动修正为 collect")
|
||||
|
||||
if not info["author"]:
|
||||
info["author"] = os.getenv("GITHUB_ACTOR", "未知作者")
|
||||
corrections.append(f"author 自动设置为 {info['author']}")
|
||||
if not info["authors"]:
|
||||
info["authors"] = os.getenv("GITHUB_ACTOR", "未知作者")
|
||||
corrections.append(f"author 自动设置为 {info['authors']}")
|
||||
|
||||
return corrections
|
||||
|
||||
@@ -434,9 +434,9 @@ def initialize_data(data, file_path):
|
||||
info["type"] = "collect"
|
||||
messages.append(f"⚠️ 文件缺少 type 字段,已设置为默认值: collect")
|
||||
|
||||
if "author" not in info:
|
||||
info["author"] = os.getenv("GITHUB_ACTOR", "未知作者")
|
||||
messages.append(f"⚠️ 文件缺少 author 字段,已设置为: {info['author']}")
|
||||
if "authors" not in info:
|
||||
info["authors"] = os.getenv("GITHUB_ACTOR", "未知作者")
|
||||
messages.append(f"⚠️ 文件缺少 author 字段,已设置为: {info['authors']}")
|
||||
|
||||
if "version" not in info:
|
||||
info["version"] = DEFAULT_VERSION
|
||||
|
||||
Reference in New Issue
Block a user