Skip to content

Commit

Permalink
non-version commits get added to release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
builder555 committed Jan 27, 2024
1 parent ce3394e commit 4b081f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/scripts/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def __init__(self):
self.breaking = []
self.features = []
self.fixes = []
self.other = []

def add_breaking(self, commit):
self.breaking.append(commit.removeprefix("fix!").removeprefix("feat!"))
Expand All @@ -17,6 +18,9 @@ def add_features(self, commit):

def add_fixes(self, commit):
self.fixes.append(commit.removeprefix("fix:"))

def add_other(self, commit):
self.other.append(commit.removeprefix("chore:"))

def __repr__(self):
text = ""
Expand All @@ -26,6 +30,8 @@ def __repr__(self):
text += "## Features\n* " + "\n* ".join(self.features) + "\n\n"
if self.fixes:
text += "## Fixes\n* " + "\n* ".join(self.fixes) + "\n\n"
if self.other:
text += "## Other\n* " + "\n* ".join(self.other) + "\n\n"
return text


Expand Down Expand Up @@ -59,13 +65,15 @@ def parse_commits(commits: list[str]) -> tuple[ReleaseNotes, dict[str, int]]:
version_bump["minor"] = 0
version_bump["patch"] = 0
notes.add_breaking(commit)
if commit.startswith("fix:"):
elif commit.startswith("fix:"):
version_bump["patch"] += 1
notes.add_fixes(commit)
if commit.startswith("feat:"):
elif commit.startswith("feat:"):
version_bump["minor"] += 1
version_bump["patch"] = 0
notes.add_features(commit)
else:
notes.add_other(commit)

return notes, version_bump

Expand Down

0 comments on commit 4b081f9

Please sign in to comment.