feat: Add others scopes for release tool (#14844)

Co-authored-by: caishunfeng <caishunfeng2021@gmail.com>
(cherry picked from commit 46c0eb48c6)
This commit is contained in:
Jay Chung 2023-09-02 10:14:21 +08:00
parent baf7b5ef45
commit 9d4f9a7457
1 changed files with 5 additions and 5 deletions

View File

@ -51,6 +51,7 @@ class Changelog:
self.improvements = []
self.documents = []
self.chores = []
self.others = []
def generate(self) -> str:
"""Generate changelog."""
@ -77,6 +78,9 @@ class Changelog:
if self.chores:
detail = f"## Chore{self.changelog_prefix}{self._convert(self.chores)}{self.changelog_suffix}"
final.append(detail)
if self.others:
detail = f"## Others{self.changelog_prefix}{self._convert(self.others)}{self.changelog_suffix}"
final.append(detail)
return "\n".join(final)
@staticmethod
@ -105,11 +109,7 @@ class Changelog:
elif self._is_chore(pr):
self.chores.append(pr)
else:
raise KeyError(
"There must at least one of labels `feature|bug|improvement|document|chore`"
"but it do not, pr: %s",
pr["html_url"],
)
self.others.append(pr)
def _is_feature(self, pr: Dict) -> bool:
"""Belong to feature pull requests."""