Skip to content

Commit

Permalink
ci: fix conventional commits log parser
Browse files Browse the repository at this point in the history
  • Loading branch information
zitsen committed Jul 18, 2022
1 parent 146db65 commit 07a5a44
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ci/changelog-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 07a5a44

Please sign in to comment.