diff --git a/ci/changelog-generate.sh b/ci/changelog-generate.sh index ded10eaa..00a4e2f5 100755 --- a/ci/changelog-generate.sh +++ b/ci/changelog-generate.sh @@ -11,17 +11,14 @@ fi function part() { name=$1 pattern=$2 - changes=$(grep -P '\[\w+-\d+\]\s*<('$pattern')>:' ./releaseNotes.tmp | sed -E 's/ *<('$pattern')>//' |sed 's/[ci skip]\s*//' | awk -F: '{print "- " $1 ":" $2}'|sort|uniq) - changes2=$(grep -P '^('$pattern')(\(.*\))?:' ./releaseNotes.tmp | sed -E 's/^('$pattern')(\(.*\)):\s*/**\2**: /' | sed -E 's/^('$pattern'):\s*//'|sed -E 's/\[ci skip\]\s*//' | awk '{print "- " $0}' |sort|uniq) - lines1=$(printf "\\$changes" |wc -l) - lines2=$(printf "\\$changes2" |wc -l) - lines=$(expr $line1 + $lines2) - #echo $name $pattern $lines >&2 - if [ $lines -gt 0 ]; then + changes=$(grep -P '\[\w+-\d+\]\s*<('$pattern')>:' ./releaseNotes.tmp | sed -E 's/ *<('$pattern')>//' |sed 's/[ci skip]\s*//' | awk -F: '{print "- " $1 ":" $2}'| sed -E 's/^\s+|\s$//' | sort|uniq) + changes2=$(grep -P '^('$pattern')(\(.*\))?:' ./releaseNotes.tmp | sed -E 's/^('$pattern')(\(.*\)):\s*/**\2**: /' | sed -E 's/^('$pattern'):\s*//'|sed -E 's/\[ci skip\]\s*//' | awk '{print "- " $0}' | sed -E 's/^\s+|\s$//' |sort|uniq) + + if [ "$changes" != "" ] || [ "$changes2" != "" ]; then echo "### $name:" echo "" - [ $lines1 -gt 0 ] && echo "$changes" - [ $lines2 -gt 0 ] && echo "$changes2" + [ "$changes" != "" ] && echo "$changes" + [ "$changes2" != "" ] && echo "$changes2" echo "" fi }