2021-05-04 12:48:39 +02:00
|
|
|
#!/bin/sh
|
2023-12-11 21:06:41 +01:00
|
|
|
|
|
|
|
# Accept a parameter to determine the filter type
|
|
|
|
FILTER_TYPE=$1
|
|
|
|
|
2021-08-20 13:44:20 +02:00
|
|
|
HEAD=`git rev-parse --abbrev-ref --symbolic-full-name HEAD`
|
2021-09-13 15:09:37 +02:00
|
|
|
if [ "$HEAD" = "master" ]
|
2021-08-20 13:44:20 +02:00
|
|
|
then
|
|
|
|
TAG=`git tag | sort | tail -n 1`
|
|
|
|
else
|
|
|
|
CURRENTTAG=`git describe --tags`
|
|
|
|
TAG=`git describe --abbrev=0 --tags $CURRENTTAG^`
|
|
|
|
fi
|
2018-07-22 16:49:59 +02:00
|
|
|
HASH=`git show-ref -s $TAG`
|
2023-12-11 21:06:41 +01:00
|
|
|
|
|
|
|
# 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
|