Skip to content

Commit 1340197

Browse files
authored
ci: support semver breaking changes (#6963)
1 parent cd7116b commit 1340197

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

scripts/create-github-release.mjs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ const rawLog = execSync(
123123
).trim()
124124

125125
const typeOrder = [
126+
'breaking',
126127
'feat',
127128
'fix',
128129
'perf',
@@ -133,6 +134,7 @@ const typeOrder = [
133134
'ci',
134135
]
135136
const typeLabels = {
137+
breaking: '⚠️ Breaking Changes',
136138
feat: 'Features',
137139
fix: 'Fix',
138140
perf: 'Performance',
@@ -158,11 +160,12 @@ for (const line of commits) {
158160
// Skip release commits
159161
if (subject.startsWith('ci: changeset release')) continue
160162

161-
// Parse conventional commit: type(scope): message
162-
const conventionalMatch = subject.match(/^(\w+)(?:\(([^)]*)\))?:\s*(.*)$/)
163+
// Parse conventional commit: type(scope)!: message
164+
const conventionalMatch = subject.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.*)$/)
163165
const type = conventionalMatch ? conventionalMatch[1] : 'other'
166+
const isBreaking = conventionalMatch ? !!conventionalMatch[3] : false
164167
const scope = conventionalMatch ? conventionalMatch[2] || '' : ''
165-
const message = conventionalMatch ? conventionalMatch[3] : subject
168+
const message = conventionalMatch ? conventionalMatch[4] : subject
166169

167170
// Only include user-facing change types
168171
if (!['feat', 'fix', 'perf', 'refactor', 'build'].includes(type)) continue
@@ -171,8 +174,9 @@ for (const line of commits) {
171174
const prMatch = message.match(/\(#(\d+)\)/)
172175
const prNumber = prMatch ? prMatch[1] : null
173176

174-
if (!groups[type]) groups[type] = []
175-
groups[type].push({ hash, email, scope, message, prNumber })
177+
const bucket = isBreaking ? 'breaking' : type
178+
if (!groups[bucket]) groups[bucket] = []
179+
groups[bucket].push({ hash, email, scope, message, prNumber })
176180
}
177181

178182
// Build markdown grouped by conventional commit type

0 commit comments

Comments
 (0)