-
Notifications
You must be signed in to change notification settings - Fork 0
/
change-log-builder.sh
68 lines (68 loc) · 2.3 KB
/
change-log-builder.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
previous_tag=0
clean=''
for current_tag in $(git tag --sort=-creatordate)
do
if [ "$previous_tag" != 0 ];then
tag_date=$(git log -1 --pretty=format:'%ad' --date=short ${previous_tag})
printf "## ${previous_tag} (${tag_date})\n\n"
# git log ${current_tag}...${previous_tag} --pretty=format:'* %s [View](./commits/%H)' --reverse | grep -v Merge
gitLogs=$(git log ${current_tag}...${previous_tag} --pretty=format:'* %s [View](./commits/%H)' --reverse)
fixes=$(grep -i -E "^\*.\sfix" <<< "${gitLogs}")
if [[ $fixes == *"fix"* ]];then
printf "### Fixes:\n\n"
printf "${fixes}"
fi
feats=$(grep -i -E "^\*.\sfeat" <<< "${gitLogs}")
if [[ $feats == *"feat"* ]];then
printf "### Features:\n\n"
printf "${feats}"
fi
perfs=$(grep -i -E "^\*.\sperf" <<< "${gitLogs}")
if [[ $perfs == *"perf"* ]];then
printf "### Improves performance:\n\n"
printf "${perfs}"
fi
refactors=$(grep -i -E "^\*.\srefactor" <<< "${gitLogs}")
if [[ $refactors == *"refactor"* ]];then
printf "### Refactoring:\n\n"
printf "${refactors}"
fi
styles=$(grep -i -E "^\*.\sstyle" <<< "${gitLogs}")
if [[ $styles == *"style"* ]];then
printf "### Style:\n\n"
printf "${styles}"
fi
tests=$(grep -i -E "^\*.\stest" <<< "${gitLogs}")
if [[ $tests == *"test"* ]];then
printf "### Style:\n\n"
printf "${tests}"
fi
docss=$(grep -i -E "^\*.\sdocs" <<< "${gitLogs}")
if [[ $docss == *"docs"* ]];then
printf "### Documentation:\n\n"
printf "${docss}"
fi
cis=$(grep -i -E "^\*.\sci" <<< "${gitLogs}")
if [[ $cis == *"ci"* ]];then
printf "### DevOps:\n\n"
printf "${cis}"
fi
builds=$(grep -i -E "^\*.\sbuild" <<< "${gitLogs}")
if [[ $builds == *"build"* ]];then
printf "### Build system or external dependencies:\n\n"
printf "${builds}"
fi
reverts=$(grep -i -E "^\*.\srevert" <<< "${gitLogs}")
if [[ $reverts == *"revert"* ]];then
printf "### Reverts:\n\n"
printf "${reverts}"
fi
printf "\n\n"
else
printf "## Unreleased\n\n"
git log ${current_tag}...HEAD --pretty=format:'* %s [View](./commits/%H)' --reverse | grep -v Merge
printf "\n"
fi
previous_tag=${current_tag}
done