Last active
August 5, 2020 23:31
-
-
Save DanielCardonaRojas/cf861172f4c9084575c6729921720e08 to your computer and use it in GitHub Desktop.
git release notes #git #awk #release #notes
This file contains hidden or 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
#! /usr/bin/awk -f | |
BEGIN { | |
FS="\][ ]*[-]*[ ]*" | |
} | |
/^\[.*\]/ { | |
sub(/\[/, "", $1) | |
if (NR == 1) { | |
previous_commit_tag = $1 | |
commit_message = "\t- " $2 | |
print previous_commit_tag "\n" commit_message | |
next | |
} | |
commit_message = "\t- " $2 | |
commit_tag = $1 | |
if(previous_commit_tag != commit_tag) { | |
print"\n" commit_tag "\n" commit_message | |
} else { | |
print commit_message | |
} | |
previous_commit_tag = commit_tag | |
} | |
END {} |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
PAST_TAG=$(git describe --tags --abbrev=0) | |
REF=${1:-$PAST_TAG} | |
git log $REF..HEAD --pretty=format:"%s" | ./format_git_log |
TODO, first parse a git commit. template.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Put both scripts in same location.
Get formatted output from latest git tag to HEAD:
./git_release_notes.sh
Get formatter output from a give commit to HEAD:
./git_release_notes.sh COMMIT_HASH
Output
Process git log where commits have been written in the format. of:
[JIRA_TICKET_ID] COMMIT_MSG
or[JIRA_TICKET_ID] - COMMIT_MSG
If multiple lines have the same ticket id these will be summarized in a section like. this