diff options
author | Esteban MIno <efmino@uc.cl> | 2018-11-09 00:54:08 +0800 |
---|---|---|
committer | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-11-16 02:12:11 +0800 |
commit | 16f928c7715eefd3e2610b7ffd69e201128c306b (patch) | |
tree | 60885673b8b492e36e5330a8f1d0a47244f87a49 /auto-changelog.sh | |
parent | 4d2d8239ce106bc64b18b134ade626f590b9844a (diff) | |
download | tangerine-wallet-browser-16f928c7715eefd3e2610b7ffd69e201128c306b.tar tangerine-wallet-browser-16f928c7715eefd3e2610b7ffd69e201128c306b.tar.gz tangerine-wallet-browser-16f928c7715eefd3e2610b7ffd69e201128c306b.tar.bz2 tangerine-wallet-browser-16f928c7715eefd3e2610b7ffd69e201128c306b.tar.lz tangerine-wallet-browser-16f928c7715eefd3e2610b7ffd69e201128c306b.tar.xz tangerine-wallet-browser-16f928c7715eefd3e2610b7ffd69e201128c306b.tar.zst tangerine-wallet-browser-16f928c7715eefd3e2610b7ffd69e201128c306b.zip |
add comments
Diffstat (limited to 'auto-changelog.sh')
-rwxr-xr-x | auto-changelog.sh | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/auto-changelog.sh b/auto-changelog.sh index 157290750..722207880 100755 --- a/auto-changelog.sh +++ b/auto-changelog.sh @@ -1,14 +1,22 @@ #! /bin/bash +# update tags git fetch --tags -URL="https://github.com/MetaMask/metamask-extension/pull/" -LOG=$(git log $(git describe --tags $(git rev-list --tags --max-count=1))..HEAD --pretty="%s::%b" --reverse --grep="Merge pull request #" --grep="(#"); +# get origin +ORIGIN=$(git config --get remote.origin.url) +URL=$(echo $ORIGIN | sed -E 's/(.*).git{1}(.*)/\1/') +# get git logs from last tag until HEAD, pretty by 'subject::body' filteres by grep for PR made with Github squash merge or Github regular merge +LOG=$(git log $(git describe --tags $(git rev-list --tags --max-count=1))..HEAD --pretty="%s::%b" --reverse --grep="Merge pull request #" --grep="(#"); while read -r line; do - SUBJECT="$(echo $line | sed -E 's/(.*):{2}(.*)/\1/')" + # get git log subject + SUBJECT="$(echo $line | sed -E 's/(.*):{2}(.*)/\1/')" + # get git log PR id, PR made with Github squash merge or Github regular merge PR=$(echo $SUBJECT | sed 's/^.*(#\([^&]*\)).*/\1/' | sed 's/^.*#\([^&]*\) from.*/\1/') - if [ -z "$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')" ]; then - MESSAGE=$(echo $SUBJECT | sed "s/(#$PR)//g"); else - MESSAGE=$(echo $line | sed -E 's/(.*):{2}(.*)/\2/') + # if PR made with Github squah merge, subject is the body + if [ -z "$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')" ]; then + BODY=$(echo $SUBJECT | sed "s/(#$PR)//g"); else + BODY=$(echo $line | sed -E 's/(.*):{2}(.*)/\2/') fi - sed -i "/## Current Develop Branch/a - [#$PR]($URL$PR): $MESSAGE" CHANGELOG.md; + # add entry to CHANGELOG + sed -i "/## Current Develop Branch/a - [#$PR]($URL/pull/$PR): $BODY" CHANGELOG.md; done <<< "$LOG" echo "CHANGELOG updated" |