You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.3 KiB
27 lines
1.3 KiB
6 years ago
|
#! /bin/bash
|
||
6 years ago
|
# update tags
|
||
6 years ago
|
git fetch --tags
|
||
6 years ago
|
# get origin
|
||
6 years ago
|
URL='https://github.com/MetaMask/metamask-extension'
|
||
6 years ago
|
# get git logs from last tag until HEAD, pretty by 'subject::body' filtered by grep for PRs made with Github squash merge or Github regular merge
|
||
6 years ago
|
LOG=$(git log $(git describe --tags $(git rev-list --tags --max-count=1))..HEAD --pretty="%s::%b" --reverse --grep="Merge pull request #" --grep="(#");
|
||
6 years ago
|
while read -r line; do
|
||
6 years ago
|
# get git log subject
|
||
6 years ago
|
SUBJECT=$(echo $line | sed -E 's/(.*):{2}(.*)/\1/')
|
||
6 years ago
|
# get git log PR id, PR made with Github squash merge or Github regular merge
|
||
6 years ago
|
PR=$(echo $SUBJECT | sed 's/^.*(#\([^&]*\)).*/\1/' | sed 's/^.*#\([^&]*\) from.*/\1/')
|
||
6 years ago
|
# if PR made with Github squash merge, subject is the body
|
||
6 years ago
|
if [ -z "$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')" ]; then
|
||
6 years ago
|
BODY=$(echo $SUBJECT | sed "s/(#$PR)//g"); else
|
||
|
BODY=$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')
|
||
6 years ago
|
fi
|
||
6 years ago
|
# add entry to CHANGELOG
|
||
6 years ago
|
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||
|
sed -i'' '/## Current Develop Branch/a\
|
||
|
- [#'"$PR"']('"$URL"'/pull/'"$PR"'): '"$BODY"''$'\n' CHANGELOG.md; else
|
||
|
sed -i '' '/## Current Develop Branch/a\
|
||
6 years ago
|
- [#'"$PR"']('"$URL"'/pull/'"$PR"'): '"$BODY"''$'\n' CHANGELOG.md;
|
||
6 years ago
|
fi
|
||
6 years ago
|
done <<< "$LOG"
|
||
6 years ago
|
echo 'CHANGELOG updated'
|