File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Get the last tag
4+ LAST_TAG=$( git describe --tags --abbrev=0 2> /dev/null)
5+
6+ if [ -z " $LAST_TAG " ]; then
7+ echo " No tags found. Retrieving all commits."
8+ LOG_RANGE=" HEAD"
9+ else
10+ echo " Generating changelog from last tag: $LAST_TAG "
11+ LOG_RANGE=" $LAST_TAG ..HEAD"
12+ fi
13+
14+ # Retrieve commit messages excluding merge commits and format them with author names and stripped email domain as nickname
15+ CHANGELOG=$( git log --pretty=format:" - %s by %an, @%ae)" --no-merges $LOG_RANGE | sed -E ' s/@([^@]+)@([^@]+)\..*/@\1/' )
16+
17+ # Output the changelog
18+ if [ -n " $CHANGELOG " ]; then
19+ echo " # Changelog"
20+ echo "
21+ ## Changes since $LAST_TAG "
22+ echo " $CHANGELOG "
23+ else
24+ echo " No new commits since last tag."
25+ fi
You can’t perform that action at this time.
0 commit comments