aboutsummaryrefslogtreecommitdiffstats
path: root/auto-changelog.sh
blob: 3e974c8bcc8f88bb8b3f4aa9372dab2b91ae18d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#! /bin/bash
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="(#");
while read -r line; do
    SUBJECT="$(echo $line | sed -E  's/(.*):{2}(.*)/\1/')"
    PR=$(echo $line | grep -Po '#\d+' | sed "s/#//") 
    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/') 
    fi
    sed -i "/## Current Develop Branch/a - [#$PR]($URL$PR): $MESSAGE" CHANGELOG.md;
done <<< "$LOG"
echo "CHANGELOG updated"