Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Create new release note generator using git and hub (doesnt need a te…
Browse files Browse the repository at this point in the history
…mp git tag)
  • Loading branch information
stealthybox committed Nov 9, 2020
1 parent 084c057 commit 6159df3
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions hack/gen-release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

PREVIOUS_TAG=${1}
OPTIONAL_REF=${2}

usage() {
echo "This script generates a starter release note document using `git` and `hub`."
echo "It finds all of the PR's with matching commits in the git log since the indicated ref."
echo "The PR's are link formatted with their title and author and are sorted by label."
echo
echo "usage:"
echo " $0 <previous_tag>"
echo " $0 <ref1> <ref2>"
echo
echo "examples:"
echo
echo " $0 v0.7.1"
echo " $0 v0.6.0 v0.7.0"
}

if ! [ "${1}" ]; then
usage
exit 1
fi

gh_prs() {
hub pr list -s closed \
--format "_commits_%sm_%sB_%sH_commits_ %l - %t ([%i](%U), [%au](https://github.com/%au))%n"
}

git_shas_since() {
git log --format="_%H_" "$1..$2"
}

grep_filter() {
printf "|%s" "$@" | sed 's/^|//'
}

gh_prs \
| grep -E "$(grep_filter $(git_shas_since ${PREVIOUS_TAG} ${OPTIONAL_REF}))" \
| sed 's/^_commits_[^ ]*_commits_//' \
| sort -r `# reverse sort puts all of the un-labelled PR's at the bottom`

0 comments on commit 6159df3

Please sign in to comment.