parent
4d2d8239ce
commit
16f928c771
@ -1,14 +1,22 @@ |
|||||||
#! /bin/bash |
#! /bin/bash |
||||||
|
# update tags |
||||||
git fetch --tags |
git fetch --tags |
||||||
URL="https://github.com/MetaMask/metamask-extension/pull/" |
# get origin |
||||||
LOG=$(git log $(git describe --tags $(git rev-list --tags --max-count=1))..HEAD --pretty="%s::%b" --reverse --grep="Merge pull request #" --grep="(#"); |
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 |
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/') |
PR=$(echo $SUBJECT | sed 's/^.*(#\([^&]*\)).*/\1/' | sed 's/^.*#\([^&]*\) from.*/\1/') |
||||||
if [ -z "$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')" ]; then |
# if PR made with Github squah merge, subject is the body |
||||||
MESSAGE=$(echo $SUBJECT | sed "s/(#$PR)//g"); else |
if [ -z "$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')" ]; then |
||||||
MESSAGE=$(echo $line | sed -E 's/(.*):{2}(.*)/\2/') |
BODY=$(echo $SUBJECT | sed "s/(#$PR)//g"); else |
||||||
|
BODY=$(echo $line | sed -E 's/(.*):{2}(.*)/\2/') |
||||||
fi |
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" |
done <<< "$LOG" |
||||||
echo "CHANGELOG updated" |
echo "CHANGELOG updated" |
||||||
|
Loading…
Reference in new issue