From 4c2231feb5842973e9724b0166ad1e8073419280 Mon Sep 17 00:00:00 2001 From: snowykami Date: Tue, 17 Sep 2024 14:59:49 +0800 Subject: [PATCH] =?UTF-8?q?:package:=20docs:=20=E8=B5=84=E6=BA=90=E5=95=86?= =?UTF-8?q?=E5=BA=97=E6=96=B0=E5=A2=9E=E5=8F=91=E5=B8=83=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki_flow/const.py | 2 +- liteyuki_flow/resource_handler.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/liteyuki_flow/const.py b/liteyuki_flow/const.py index cfd8a72d..5b343336 100644 --- a/liteyuki_flow/const.py +++ b/liteyuki_flow/const.py @@ -14,4 +14,4 @@ RESOURCE_JSON = "docs/publics/resources.json" edit_content_tip = "若要修改请编辑这段front matter,不要编辑正文/If you want to modify, please edit the front matter, do not edit the body" -edit_tip = "如需修改请编辑issue,请不要新建issue,我会自动检查" +edit_tip = "如需修改请直接编辑issue,请不要新建issue,我会自动检查" diff --git a/liteyuki_flow/resource_handler.py b/liteyuki_flow/resource_handler.py index a0585790..f64ca011 100644 --- a/liteyuki_flow/resource_handler.py +++ b/liteyuki_flow/resource_handler.py @@ -25,6 +25,9 @@ headers = { # edited: 编辑资源包信息,需重新审核 # closed: 审核通过,修改json并提交 # reopened: 重新打开,无操作 +def on_first_open(github: Github, issue: Issue, repo: Repository): + issue.create_comment("已收到资源包发布请求,我会马上开始预检. " + edit_tip) + # opened | edited def pre_check(github: Github, issue: Issue, repo: Repository) -> err: @@ -36,7 +39,7 @@ def pre_check(github: Github, issue: Issue, repo: Repository) -> err: homepage = parser.front_matters.get("homepage") # optional author = parser.front_matters.get("author") if not all((name, desc, link, author)): - issue.create_comment("name, desc, link, homepage 及 author 为必填字段." + edit_tip) + issue.create_comment("name, desc, link, homepage 及 author 为必填字段.") return ValueError("name, desc, link, homepage 及 author 为必填字段.") # 下载并解析资源包 @@ -54,12 +57,12 @@ def pre_check(github: Github, issue: Issue, repo: Repository) -> err: # 检测包内metadata.yml文件 data = yaml.load(open(f"tmp/{name}/metadata.yml"), Loader=yaml.SafeLoader) except Exception: - issue.create_comment("解析资源包失败,可能是格式问题或metadata.yml不存在." + edit_tip) + issue.create_comment("解析资源包失败,可能是格式问题或metadata.yml不存在.") return ValueError("解析资源包失败,可能是格式问题或metadata.yml不存在.") # 检测必要字段 name,description,version if not all((data.get("name"), data.get("description"), data.get("version"))): - issue.create_comment("元数据中缺少必要字段 name, description 或 version." + edit_tip) + issue.create_comment("元数据中缺少必要字段 name, description 或 version.") return ValueError("元数据中缺少必要字段 name, description 或 version.") # 不检测重复资源包,因为资源包可能有多个版本