Skip to content

Commit e6ae1ec

Browse files
authored
chore: removed empty sections for and prefix text in commit for Discord (#68)
1 parent e222bf8 commit e6ae1ec

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,27 @@ jobs:
333333
- name: Format Release Notes
334334
id: format_notes
335335
run: |
336-
echo "**🚀 Features**" > formatted_notes.txt
337-
echo "$(echo "$RELEASE_NOTES" | grep -iE '^\*\s\[[a-f0-9]+\]\(.*\):\sfeat' | head -n 5 || echo 'None')" >> formatted_notes.txt
338-
echo "" >> formatted_notes.txt
339-
340-
echo "**🐛 Fixes**" >> formatted_notes.txt
341-
echo "$(echo "$RELEASE_NOTES" | grep -iE '^\*\s\[[a-f0-9]+\]\(.*\):\sfix' | head -n 5 || echo 'None')" >> formatted_notes.txt
342-
echo "" >> formatted_notes.txt
336+
337+
features=$(echo "$RELEASE_NOTES" | grep -iE '^\*\s\[[a-f0-9]+\]\(.*\):\sfeat' | head -n 5)
338+
if [[ -n "$features" ]]; then
339+
echo "**🚀 Features**" > formatted_notes.txt
340+
echo "$features" >> formatted_notes.txt
341+
echo "" >> formatted_notes.txt
342+
fi
343+
344+
fixes=$(echo "$RELEASE_NOTES" | grep -iE '^\*\s\[[a-f0-9]+\]\(.*\):\s(fix|bug|improvement|patch)' | head -n 5)
345+
if [[ -n "$fixes" ]]; then
346+
echo "**🐛 Fixes**" >> formatted_notes.txt
347+
echo "$fixes" >> formatted_notes.txt
348+
echo "" >> formatted_notes.txt
349+
fi
343350

344-
echo "**🛠 Chores**" >> formatted_notes.txt
345-
echo "$(echo "$RELEASE_NOTES" | grep -iE '^\*\s\[[a-f0-9]+\]\(.*\):\schore' | head -n 5 || echo 'None')" >> formatted_notes.txt
346-
echo "" >> formatted_notes.txt
351+
chores=$(echo "$RELEASE_NOTES" | grep -iE '^\*\s\[[a-f0-9]+\]\(.*\):\s(chore|docs|build|ci)' | head -n 5)
352+
if [[ -n "$chores" ]]; then
353+
echo "**🛠 Chores**" >> formatted_notes.txt
354+
echo "$chores" >> formatted_notes.txt
355+
echo "" >> formatted_notes.txt
356+
fi
347357

348358
cat formatted_notes.txt
349359
FORMATTED_NOTES=$(cat formatted_notes.txt)
@@ -355,6 +365,9 @@ jobs:
355365
env:
356366
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_RELEASE_URL }}
357367
run: |
368+
369+
FORMATTED_NOTES=$(echo "$FORMATTED_NOTES" | sed -E 's/\): [^:]+:/) :/g')
370+
358371
default_color="#1ac4c5"
359372
hex_to_decimal() { printf '%d' "0x${1#"#"}"; }
360373
embed_color=$(hex_to_decimal "$default_color")

0 commit comments

Comments
 (0)