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")
|
2023-12-11 21:22:21 +01:00
|
|
|
sed '/android/I d; /google/I d'
|
2023-12-11 21:06:41 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cat
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# Main log extraction command with filter applied
|
|
|
|
git log --pretty=format:'* %s %b' $HASH..HEAD | \
|
2023-12-11 21:22:21 +01:00
|
|
|
sed '/Merge branch '\''master'\''/I d' | \
|
|
|
|
sed '/Merge remote-tracking branch '\''origin\/master'\''/I d' | \
|
|
|
|
sed '/Merge pull request/I d' | \
|
2023-12-11 21:06:41 +01:00
|
|
|
awk -F 'review completed for the source file' '{print $1;}' | \
|
2023-12-11 21:22:21 +01:00
|
|
|
sed '/on the(.*)language./I d' | \
|
2023-12-11 21:06:41 +01:00
|
|
|
awk -F 'Snyk has created this PR' '{print $1;}' | \
|
2023-12-11 21:22:21 +01:00
|
|
|
sed '/See this package in npm/I d; /https:\/\/www.npmjs.com\//I d; /See this project in Snyk/I d; /https:\/\/app.snyk.io/I d' | \
|
2023-12-11 21:06:41 +01:00
|
|
|
awk '!/^$/' | \
|
|
|
|
apply_filter
|