Skip to content

Commit

Permalink
fix: 修复发布流程检测判定与流程
Browse files Browse the repository at this point in the history
  • Loading branch information
BigOrangeQWQ committed Sep 9, 2024
1 parent 7efa68d commit 2fc48dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/plugins/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,20 @@ async def check_rule(
event: IssuesOpened | IssuesReopened | IssuesEdited | IssueCommentCreated,
publish_type: PublishType | None = Depends(get_type_by_labels),
) -> bool:
logger.info(f"评论来自: {event.payload.sender.name}")
if (
isinstance(event, IssueCommentCreated)
and event.payload.comment.user
and event.payload.comment.user.login.endswith(BOT_MARKER)
):
logger.info("评论来自机器人,已跳过")
return False
if (
isinstance(event, IssuesEdited)
and event.payload.sender.name
and event.payload.sender.name.endswith(BOT_MARKER)
):
logger.info("修改来自机器人,已跳过")
if event.payload.issue.pull_request:
logger.info("评论在拉取请求下,已跳过")
return False
Expand Down
10 changes: 8 additions & 2 deletions src/utils/validation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,19 @@ def plugin_test_load_validator(cls, v: bool, info: ValidationInfo) -> bool:
@field_validator("metadata", mode="before")
@classmethod
def plugin_test_metadata_validator(
cls, v: Metadata, info: ValidationInfo
cls, v: Metadata | None, info: ValidationInfo
) -> Metadata:
context = info.context
if context is None:
raise PydanticCustomError("validation_context", "未获取到验证上下文")
if v is None:
raise PydanticCustomError("plugin.metadata", "插件缺少元数据")
raise PydanticCustomError(
"plugin.metadata",
"插件缺少元数据",
{
"plugin_test_result": context.get("load"),
},
)
return v


Expand Down

0 comments on commit 2fc48dd

Please sign in to comment.