Last active
March 30, 2017 19:32
-
-
Save kanryu/f4db8e0460310309063d2cf56379b3b3 to your computer and use it in GitHub Desktop.
minimalist auto generator for CHANGELOG.md (awk)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
print "# CHANGELOG" | |
COMMIT = "" | |
OTHER_COMMIT_FIRST=1 | |
DATE = "" | |
TAG = "" | |
"git config --get remote.origin.url" | getline ORIGIN | |
} | |
/^commit/ { | |
COMMIT=$2 | |
if($0 !~ /tag:/) { | |
TAG = "" | |
next | |
} | |
TAG=gensub(/.+tag\: (.+)\)$/, "\\1", "g", $0) | |
OTHER_COMMIT_FIRST=1 | |
} | |
/^Date:/ { | |
DATE = substr($0, 9) | |
if(TAG != "") { | |
print "" | |
print "## " TAG " (" DATE ") [" substr(COMMIT, 0, 7) "](" ORIGIN "/commit/" COMMIT ")" | |
print "" | |
COMMIT = "" | |
} | |
} | |
/^ / { | |
if(TAG != "") { | |
sub(/^ +/, "") ; print | |
} else { | |
if(OTHER_COMMIT_FIRST) { | |
print "" | |
print "- other commits" | |
OTHER_COMMIT_FIRST=0 | |
} | |
sub(/^ +-?/, "") | |
print " - " $0 " (" DATE ") [" substr(COMMIT, 0, 7) "](" ORIGIN "/commit/" COMMIT ")" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
setup this script into some your favorite dir.
and create alias
so, you can generate CHANGELOG.md at local repository dir
output example
https://github.com/kanryu/quickviewer/blob/master/CHANGELOG.md