-
-
Save gesellix/46290fca3c909746809a to your computer and use it in GitHub Desktop.
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
#! /bin/sh | |
# Creates a markdown formatted change log based the git history | |
set -eu | |
OWNER=${1:-'docker-java'} | |
REPO=${2:-'docker-java'} | |
USER=$(cat ~/.git_user) | |
PASS=$(cat ~/.git_password) | |
function pullDesc() { | |
PULL_NO=$1 | |
F=/tmp/$OWNER-$REPO-pulls-$PULL_NO.json | |
if [ ! -e $F -o $(grep -c 'API rate limit exceeded' $F) -gt 0 ] ; then | |
U=https://$USER:[email protected]/repos/$OWNER/$REPO/pulls/$PULL_NO | |
curl -fo $F $U --basic | |
fi | |
cat $F | grep title|sed 's/.*"\(.*\)",/\1/' | |
} | |
echo Change Log | |
echo === | |
echo | |
git log --oneline --grep 'Merge pull request' --grep 'prepare release' | while read L ; do | |
if [ $(echo $L | grep -c 'Merge pull request') -eq 1 ] ; then | |
PULL_NO=$(echo $L | sed 's/.*#\([^ ]*\).*/\1/') | |
echo " * [#$PULL_NO](https://github.com/docker-java/docker-java/pull/$PULL_NO) $(pullDesc $PULL_NO)" | |
elif [ $(echo $L | grep -c 'prepare release') -eq 1 ] ; then | |
echo | |
echo $(echo $L | sed 's/.*prepare release//') | |
echo --- | |
echo | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment