From 8c305bc4fe70b5927c1a9173eb1ea6f2c1253a58 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Mon, 11 Dec 2023 16:06:41 -0400 Subject: [PATCH] ADD: Platform option for releasenotes script --- scripts/release-notes.sh | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/scripts/release-notes.sh b/scripts/release-notes.sh index 8da6f18b5..f8a748aaa 100755 --- a/scripts/release-notes.sh +++ b/scripts/release-notes.sh @@ -1,4 +1,8 @@ #!/bin/sh + +# Accept a parameter to determine the filter type +FILTER_TYPE=$1 + HEAD=`git rev-parse --abbrev-ref --symbolic-full-name HEAD` if [ "$HEAD" = "master" ] then @@ -8,4 +12,30 @@ else TAG=`git describe --abbrev=0 --tags $CURRENTTAG^` fi HASH=`git show-ref -s $TAG` -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 '!/^$/' + +# 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