Skip to content

Commit 27b4d2e

Browse files
Merge pull request #268 from monta-app/feat/add-build-revert-commit-types
feat: add build and revert conventional commit types
2 parents 3138a44 + 461f09c commit 27b4d2e

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

src/commonMain/kotlin/com.monta.changelog/model/ConventionalCommitType.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ enum class ConventionalCommitType(
6060
sortOrder = 8,
6161
values = listOf("ci")
6262
),
63+
Build(
64+
title = "Build",
65+
emoji = "\uD83D\uDCE6",
66+
sortOrder = 9,
67+
values = listOf("build")
68+
),
69+
Revert(
70+
title = "Revert",
71+
emoji = "\u23EA",
72+
sortOrder = 10,
73+
values = listOf("revert")
74+
),
6375
;
6476

6577
companion object {

src/commonTest/kotlin/com/monta/changelog/git/CommitMapperTest.kt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.monta.changelog.git
22

3+
import com.monta.changelog.model.ConventionalCommitType
34
import io.kotest.core.spec.style.StringSpec
45
import io.kotest.matchers.nulls.shouldBeNull
56
import io.kotest.matchers.nulls.shouldNotBeNull
@@ -107,6 +108,41 @@ class CommitMapperTest :
107108
commit.shouldBeNull()
108109
}
109110

111+
"should map build commit type" {
112+
val logItem = LogItem(
113+
author = Author(date = "2026-01-12", email = "test@test.com", name = "Test"),
114+
committer = Author(date = "2026-01-12", email = "test@test.com", name = "Test"),
115+
commit = "abc123",
116+
subject = "build(deps): bump kotlin to 2.0",
117+
body = "",
118+
parents = "parent1"
119+
)
120+
121+
val commit = mapper.fromGitLogItem(logItem)
122+
123+
commit.shouldNotBeNull()
124+
commit.type shouldBe ConventionalCommitType.Build
125+
commit.scope shouldBe "deps"
126+
commit.message shouldBe "bump kotlin to 2.0"
127+
}
128+
129+
"should map revert commit type" {
130+
val logItem = LogItem(
131+
author = Author(date = "2026-01-12", email = "test@test.com", name = "Test"),
132+
committer = Author(date = "2026-01-12", email = "test@test.com", name = "Test"),
133+
commit = "abc123",
134+
subject = "revert: undo previous change",
135+
body = "",
136+
parents = "parent1"
137+
)
138+
139+
val commit = mapper.fromGitLogItem(logItem)
140+
141+
commit.shouldNotBeNull()
142+
commit.type shouldBe ConventionalCommitType.Revert
143+
commit.message shouldBe "undo previous change"
144+
}
145+
110146
"should map commit with double quotes in subject" {
111147
val logItem = LogItem(
112148
author = Author(date = "2026-01-12", email = "test@test.com", name = "Test"),

0 commit comments

Comments
 (0)