11#! /bin/bash
22
3+ echo " inside the script"
34generate_categorized_changelog () {
5+ echo " testing"
46 local previous_tag=" $1 "
57 local git_log_command
68
@@ -12,19 +14,62 @@ generate_categorized_changelog() {
1214
1315 echo " ## What's Changed"
1416
17+ # Store all commits in a temporary file
18+ all_commits=$( mktemp)
19+ $git_log_command --pretty=format:" * %s (%h)" --reverse > " $all_commits "
20+
1521 # Features
16- echo " ### 🚀 Features"
17- $git_log_command --pretty=format:" * %s (%h)" --reverse | grep " ^* feat" || true
22+ features=$( grep -i " ^* feat:" " $all_commits " || true)
23+ if [ -n " $features " ]; then
24+ echo -e " \n### 🚀 Features"
25+ echo " $features "
26+ fi
1827
1928 # Bug Fixes
20- echo -e " \n### 🐛 Bug Fixes"
21- $git_log_command --pretty=format:" * %s (%h)" --reverse | grep " ^* fix" || true
29+ fixes=$( grep -i " ^* fix:" " $all_commits " || true)
30+ if [ -n " $fixes " ]; then
31+ echo -e " \n### 🐛 Bug Fixes"
32+ echo " $fixes "
33+ fi
2234
2335 # Documentation
24- echo -e " \n### 📚 Documentation"
25- $git_log_command --pretty=format:" * %s (%h)" --reverse | grep " ^* docs" || true
36+ docs=$( grep -i " ^* docs:" " $all_commits " || true)
37+ if [ -n " $docs " ]; then
38+ echo -e " \n### 📚 Documentation"
39+ echo " $docs "
40+ fi
41+
42+ # Style Changes
43+ styles=$( grep -i " ^* style:" " $all_commits " || true)
44+ if [ -n " $styles " ]; then
45+ echo -e " \n### 💎 Style Changes"
46+ echo " $styles "
47+ fi
48+
49+ # Tests
50+ tests=$( grep -i " ^* test:" " $all_commits " || true)
51+ if [ -n " $tests " ]; then
52+ echo -e " \n### 🧪 Tests"
53+ echo " $tests "
54+ fi
55+
56+ # CI Changes
57+ ci=$( grep -i " ^* ci:" " $all_commits " || true)
58+ if [ -n " $ci " ]; then
59+ echo -e " \n### 🔄 CI/CD Updates"
60+ echo " $ci "
61+ fi
2662
2763 # Other Changes
28- echo -e " \n### 🔧 Other Changes"
29- $git_log_command --pretty=format:" * %s (%h)" --reverse | grep -v " ^* feat\|^* fix\|^* docs" || true
30- }
64+ others=$( grep -i -v " ^* feat:\|^* fix:\|^* docs:\|^* style:\|^* test:\|^* ci:" " $all_commits " || true)
65+ if [ -n " $others " ]; then
66+ echo -e " \n### 🔧 Other Changes"
67+ echo " $others "
68+ fi
69+
70+ # Cleanup
71+ rm " $all_commits "
72+ }
73+
74+ # changelog=$(generate_categorized_changelog)
75+ # echo "$changelog"
0 commit comments