-
Notifications
You must be signed in to change notification settings - Fork 22
/
changelog.py
26 lines (23 loc) · 942 Bytes
/
changelog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import git
import semantic_release
from semantic_release import ParserOptions
from semantic_release.enums import LevelBump
class PythonSDKCommitParser(
semantic_release.CommitParser[semantic_release.ParseResult, semantic_release.ParserOptions]
):
parser_options = ParserOptions
def parse(self, commit: "git.objects.commit.Commit") -> "semantic_release.ParseResult":
if (
"generated by python-semantic-release" in commit.message
or commit.message.startswith("Merge pull request")
or commit.message.startswith("Merge branch")
):
return semantic_release.ParseError(commit=commit, error="Inappropriate commit message")
return semantic_release.ParsedCommit(
bump=LevelBump.MINOR,
type="feature",
descriptions=[commit.message],
breaking_descriptions=[],
commit=commit,
scope="",
)