Last active
May 14, 2020 22:58
-
-
Save particledecay/7e4bfad1236856a194139bce3655b755 to your computer and use it in GitHub Desktop.
Generate a changelog/release notes using Conventional Commit standards
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
# one-liner | |
if [ -z "$(git tag -l --sort=v:refname | tail -1)" ]; then git log --oneline --all; else git log --oneline $(git tag -l --sort=v:refname | tail -1)..$(git rev-parse --abbrev-ref HEAD); fi | awk '$2 ~ /:/' | sort -sk 2,2 | awk 'BEGIN {print "## Changelog"} NR == 1 {print "- " $0; type = gensub(/(\w+).*:/, "\\1", 1, $2)} NR > 1 && $2 !~ type {print ""} NR > 1 {print "- " $0; type = gensub(/(\w+).*:/, "\\1", 1, $2)}' | |
# nicely formatted | |
if [ -z "$(git tag -l --sort=v:refname | tail -1)" ] | |
then | |
git log --oneline --all | |
else | |
git log --oneline $(git tag -l --sort=v:refname | tail -1)..$(git rev-parse --abbrev-ref HEAD) | |
fi | awk '$2 ~ /:/' \ | |
| sort -sk 2,2 \ | |
| awk 'BEGIN {print "## Changelog"} | |
NR == 1 {print "- " $0; type = gensub(/(\w+).*:/, "\\1", 1, $2)} | |
NR > 1 && $2 !~ type {print ""} | |
NR > 1 {print "- " $0; type = gensub(/(\w+).*:/, "\\1", 1, $2)}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Edited to avoid grouping by scope unnecessarily