Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions scripts/create-github-release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const rawLog = execSync(
).trim()

const typeOrder = [
'breaking',
'feat',
'fix',
'perf',
Expand All @@ -133,6 +134,7 @@ const typeOrder = [
'ci',
]
const typeLabels = {
breaking: '⚠️ Breaking Changes',
feat: 'Features',
fix: 'Fix',
perf: 'Performance',
Expand All @@ -158,11 +160,12 @@ for (const line of commits) {
// Skip release commits
if (subject.startsWith('ci: changeset release')) continue

// Parse conventional commit: type(scope): message
const conventionalMatch = subject.match(/^(\w+)(?:\(([^)]*)\))?:\s*(.*)$/)
// Parse conventional commit: type(scope)!: message
const conventionalMatch = subject.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.*)$/)
const type = conventionalMatch ? conventionalMatch[1] : 'other'
const isBreaking = conventionalMatch ? !!conventionalMatch[3] : false
const scope = conventionalMatch ? conventionalMatch[2] || '' : ''
const message = conventionalMatch ? conventionalMatch[3] : subject
const message = conventionalMatch ? conventionalMatch[4] : subject

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

if (!groups[type]) groups[type] = []
groups[type].push({ hash, email, scope, message, prNumber })
const bucket = isBreaking ? 'breaking' : type
if (!groups[bucket]) groups[bucket] = []
groups[bucket].push({ hash, email, scope, message, prNumber })
}

// Build markdown grouped by conventional commit type
Expand Down
Loading