File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ generate_categorized_changelog () {
4+ local previous_tag=" $1 "
5+ local git_log_command
6+
7+ if [ -n " $previous_tag " ]; then
8+ git_log_command=" git log $previous_tag ..HEAD"
9+ else
10+ git_log_command=" git log"
11+ fi
12+
13+ echo " ## What's Changed"
14+
15+ # Features
16+ echo " ### 🚀 Features"
17+ $git_log_command --pretty=format:" * %s (%h)" --reverse | grep " ^* feat" || true
18+
19+ # Bug Fixes
20+ echo -e " \n### 🐛 Bug Fixes"
21+ $git_log_command --pretty=format:" * %s (%h)" --reverse | grep " ^* fix" || true
22+
23+ # Documentation
24+ echo -e " \n### 📚 Documentation"
25+ $git_log_command --pretty=format:" * %s (%h)" --reverse | grep " ^* docs" || true
26+
27+ # Other Changes
28+ echo -e " \n### 🔧 Other Changes"
29+ $git_log_command --pretty=format:" * %s (%h)" --reverse | grep -v " ^* feat\|^* fix\|^* docs" || true
30+ }
31+
32+ # Usage in workflow:
33+ # CHANGELOG=$(generate_categorized_changelog "$PREVIOUS_TAG")
34+ # echo "CHANGELOG<<EOF" >> $GITHUB_ENV
35+ # echo "$CHANGELOG" >> $GITHUB_ENV
36+ # echo "EOF" >> $GITHUB_ENV
Original file line number Diff line number Diff line change @@ -208,6 +208,25 @@ jobs:
208208 echo "URL=${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ env.VERSION }}" >> $GITHUB_ENV
209209 fi
210210
211+ - name : Generate Changelog
212+ if : env.CREATE_RELEASE == 'true'
213+ id : changelog
214+ run : |
215+ if [ -n "${{ env.PREV_TAG }}" ]; then
216+ echo "CHANGELOG<<EOF" >> $GITHUB_ENV
217+ echo "## What's Changed" >> $GITHUB_ENV
218+ git log ${{ env.PREV_TAG }}..HEAD --pretty=format:"* %s (%h)" --reverse | while read -r line; do
219+ echo "* ${line}" >> $GITHUB_ENV
220+ done
221+ echo "EOF" >> $GITHUB_ENV
222+ else
223+ echo "CHANGELOG<<EOF" >> $GITHUB_ENV
224+ echo "## What's Changed" >> $GITHUB_ENV
225+ git log --pretty=format:"* %s (%h)" --reverse | while read -r line; do
226+ echo "* ${line}" >> $GITHUB_ENV
227+ done
228+ echo "
229+
211230 - name : Debug Release Notes
212231 if : env.CREATE_RELEASE == 'true'
213232 run : |
@@ -223,6 +242,7 @@ jobs:
223242 tag_name : ${{ env.VERSION }}
224243 name : ${{ env.VERSION }}
225244 body : |
245+ ${{ env.CHANGELOG }}
226246 **Full Changelog**: ${{ env.URL }}
227247 draft : false
228248 prerelease : false
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " python-template"
3- version = " 0.5.27 "
3+ version = " 0.5.28 "
44description = " Used to templatize python projects."
55authors = [" Loïc Motheu <lmotheu@gmail.com>" ]
66readme = " README.md"
You can’t perform that action at this time.
0 commit comments