Skip to content

Commit

Permalink
fix: 修复拉取请求缺少发布标签的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Dec 17, 2024
1 parent 9a1cbac commit fcb0e7f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/

- 插件测试中使用 uv 来控制 Python 版本并与本体共享依赖

### Fixed

- 修复拉取请求缺少发布标签的问题

## [4.1.4] - 2024-12-08

### Fixed
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/github/plugins/publish/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from nonebot import logger

from src.plugins.github import plugin_config
from src.plugins.github.constants import ISSUE_FIELD_PATTERN, ISSUE_FIELD_TEMPLATE
from src.plugins.github.constants import (
ISSUE_FIELD_PATTERN,
ISSUE_FIELD_TEMPLATE,
PUBLISH_LABEL,
)
from src.plugins.github.depends.utils import get_type_by_labels
from src.plugins.github.handlers import GithubHandler, IssueHandler
from src.plugins.github.typing import PullRequestList
Expand Down Expand Up @@ -221,7 +225,7 @@ async def process_pull_request(
title,
branch_name,
)
await handler.add_labels(pull_number, result.type.value)
await handler.add_labels(pull_number, [PUBLISH_LABEL, result.type.value])
except RequestFailed:
# 如果之前已经创建了拉取请求,则将其转换为草稿
logger.info("该分支的拉取请求已创建,请前往查看")
Expand Down
8 changes: 4 additions & 4 deletions tests/plugins/github/publish/process/test_publish_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async def test_bot_process_publish_check(
"owner": "he0119",
"repo": "action-test",
"issue_number": 2,
"labels": ["Bot"],
"labels": ["Publish", "Bot"],
},
True,
)
Expand Down Expand Up @@ -328,7 +328,7 @@ async def test_adapter_process_publish_check(
"owner": "he0119",
"repo": "action-test",
"issue_number": 2,
"labels": ["Adapter"],
"labels": ["Publish", "Adapter"],
},
True,
)
Expand Down Expand Up @@ -615,7 +615,7 @@ async def test_plugin_process_publish_check(
"owner": "he0119",
"repo": "action-test",
"issue_number": 2,
"labels": ["Plugin"],
"labels": ["Publish", "Plugin"],
},
True,
)
Expand Down Expand Up @@ -907,7 +907,7 @@ async def test_plugin_process_publish_check_re_run(
"owner": "he0119",
"repo": "action-test",
"issue_number": 2,
"labels": ["Plugin"],
"labels": ["Publish", "Plugin"],
},
True,
)
Expand Down

0 comments on commit fcb0e7f

Please sign in to comment.