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