Skip to content

Commit 8df6cb4

Browse files
authored
chore(release): categorize changelog by commit type (#65)
1 parent 5965313 commit 8df6cb4

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,56 @@ jobs:
257257
PREVIOUS_TAG=$(git describe --abbrev=0 --tags --match "v*" 2>/dev/null || echo "")
258258
if [ -z "$PREVIOUS_TAG" ]; then
259259
# First release - get all commits
260-
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
260+
COMMITS=$(git log --pretty=format:"%s (%h)|%b" --no-merges | tr '\n' ' ')
261261
else
262262
# Get commits since previous tag
263-
CHANGELOG=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
263+
COMMITS=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"%s (%h)|%b" --no-merges | tr '\n' ' ')
264+
fi
265+
266+
# Categorize commits by conventional commit type
267+
BUGS=""
268+
FEATURES=""
269+
CHORES=""
270+
271+
# Process each commit
272+
while IFS= read -r line; do
273+
subject=$(echo "$line" | cut -d'|' -f1)
274+
body=$(echo "$line" | cut -d'|' -f2-)
275+
276+
# Extract issue number from body if present
277+
issue=$(echo "$body" | grep -oE "Fixes #[0-9]+" | head -1 || echo "")
278+
if [ -n "$issue" ]; then
279+
entry="- $subject - $issue"
280+
else
281+
entry="- $subject"
282+
fi
283+
284+
# Categorize by prefix
285+
if echo "$subject" | grep -qE "^fix(\(|:)"; then
286+
BUGS="${BUGS}${entry}"$'\n'
287+
elif echo "$subject" | grep -qE "^feat(\(|:)"; then
288+
FEATURES="${FEATURES}${entry}"$'\n'
289+
elif echo "$subject" | grep -qE "^chore(\(|:)"; then
290+
CHORES="${CHORES}${entry}"$'\n'
291+
else
292+
# Default to chores for uncategorized
293+
CHORES="${CHORES}${entry}"$'\n'
294+
fi
295+
done < <(git log ${PREVIOUS_TAG:+$PREVIOUS_TAG..}HEAD --pretty=format:"%s (%h)|%b---END---" --no-merges | sed 's/---END---/\n/g')
296+
297+
# Build changelog with categories
298+
CHANGELOG=""
299+
300+
if [ -n "$BUGS" ]; then
301+
CHANGELOG="${CHANGELOG}### 🐛 Bugs Squashed"$'\n\n'"${BUGS}"$'\n'
302+
fi
303+
304+
if [ -n "$FEATURES" ]; then
305+
CHANGELOG="${CHANGELOG}### 🎉 Features Added"$'\n\n'"${FEATURES}"$'\n'
306+
fi
307+
308+
if [ -n "$CHORES" ]; then
309+
CHANGELOG="${CHANGELOG}### 🧹 Chores Addressed"$'\n\n'"${CHORES}"$'\n'
264310
fi
265311
266312
# If changelog is empty, use a fun message

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Claude Code Instructions for dtvem
22

3+
## Commits
4+
5+
All commits must be authored by `calvin@codingwithcalvin.net`. Do not add co-authors (including Claude) to commits.
6+
37
## Deployment
48

59
After building, always deploy both executables to the user's installation directory:

0 commit comments

Comments
 (0)