release-email-list.sh 1.89 KB
Newer Older
1
#! /bin/bash
2 3 4 5 6 7 8
# Usage: release-email-list.sh [$PREVIOUS_COMMIT [$CURRENT_COMMIT]]
#
# Prints a list of email addresses and a Confluence style wiki table
# that indicate all of the changes made between $PREVIOUS_COMMIT and $CURRENT_COMMIT
#
# PREVIOUS_COMMIT defaults to origin/release
# CURRENT_COMMIT defaults to HEAD
9

10 11 12
BASE=${1:-origin/release}
CURRENT=${2:-HEAD}
LOG_CMD="git --no-pager log $BASE..$CURRENT"
13 14 15

RESPONSIBLE=$(sort -u <($LOG_CMD --format='tformat:%ae' && $LOG_CMD --format='tformat:%ce'))

16 17
echo "Comparing $BASE to $CURRENT"

18 19
echo "~~~~ Email ~~~~~"

20 21 22 23 24 25
echo -n 'To: '
echo ${RESPONSIBLE} | sed "s/ /, /g"
echo

echo "You've made changes that are about to be released. All of the commits
that you either authored or committed are listed below. Please verify them on
26 27 28 29
\$ENVIRONMENT.

Please record your notes on https://edx-wiki.atlassian.net/wiki/display/ENG/Release+Page%3A+\$DATE
and add any bugs found to the Release Candidate Bugs section"
30 31
echo

32 33 34 35 36 37
echo "~~~~~ Wiki Table ~~~~~"
echo "Type Ctrl+Shift+D on Confluence to embed the following table in your release wiki page"
echo

echo '||Author||Changes||Commit Link||Testing Notes||'

38 39 40 41 42
for EMAIL in $RESPONSIBLE; do
    AUTHORED_BY="$LOG_CMD --author=<${EMAIL}>"
    COMMITTED_BY="$LOG_CMD --committer=<${EMAIL}>"
    COMMITTED_NOT_AUTHORED="$COMMITTED_BY $($AUTHORED_BY --format='tformat:^%h')"

43 44
    $AUTHORED_BY --format="tformat:|$EMAIL|%s|[commit|https://github.com/edx/edx-platform/commit/%h]| |" | head -n 1
    $AUTHORED_BY --format="tformat:| |%s|[commit|https://github.com/edx/edx-platform/commit/%h]| |" | tail  -n +2
45 46

    if [[ $($COMMITTED_NOT_AUTHORED) != "" ]]; then
47 48
        $COMMITTED_NOT_AUTHORED --format="tformat:|$EMAIL|%s|[commit|https://github.com/edx/edx-platform/commit/%h]|Committed, didn't author|" | head -n 1
        $COMMITTED_NOT_AUTHORED --format="tformat:| |%s|[commit|https://github.com/edx/edx-platform/commit/%h]| |" | tail -n +2
49 50
    fi
done