BlueWallet/scripts/release-notes.sh

42 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/sh
# Accept a parameter to determine the filter type
FILTER_TYPE=$1
HEAD=`git rev-parse --abbrev-ref --symbolic-full-name HEAD`
2021-09-13 15:09:37 +02:00
if [ "$HEAD" = "master" ]
then
TAG=`git tag | sort | tail -n 1`
else
CURRENTTAG=`git describe --tags`
TAG=`git describe --abbrev=0 --tags $CURRENTTAG^`
fi
HASH=`git show-ref -s $TAG`
# Define a function to apply the filter based on the parameter
apply_filter() {
case $FILTER_TYPE in
"apple")
grep -v -i "android\|google"
;;
"android")
grep -v -i "apple\|ios\|mac\|apple watch"
;;
*)
cat
;;
esac
}
# Main log extraction command with filter applied
git log --pretty=format:'* %s %b' $HASH..HEAD | \
grep -v "Merge branch 'master'" | \
grep -v "Merge remote-tracking branch 'origin/master'" | \
grep -v "Merge pull request" | \
awk -F 'review completed for the source file' '{print $1;}' | \
grep -E -v 'on the(.*)language.' | \
awk -F 'Snyk has created this PR' '{print $1;}' | \
grep -E -v 'See this package in npm|https://www.npmjs.com/|See this project in Snyk|https://app.snyk.io' | \
awk '!/^$/' | \
apply_filter