Skip to content

Commit 9707168

Browse files
committed
More edits to discord notification message
1 parent 08d0834 commit 9707168

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,28 @@ jobs:
169169
current_tag=${{ github.ref_name }}
170170
previous_tag=$(git tag --sort=-version:refname | head -n 2 | tail -n 1 || echo "")
171171
if [ -n "$previous_tag" ]; then
172-
commits=$(git log --oneline $previous_tag..$current_tag)
172+
# Get commits with full hash and message
173+
raw_commits=$(git log --format="%H %s" $previous_tag..$current_tag)
174+
175+
# Convert to markdown links
176+
linked_commits=""
177+
while IFS= read -r line; do
178+
if [ -n "$line" ]; then
179+
full_hash=$(echo "$line" | cut -d' ' -f1)
180+
short_hash=${full_hash:0:7}
181+
message=$(echo "$line" | cut -d' ' -f2-)
182+
linked_commits="${linked_commits}[$short_hash](https://github.com/${{ github.repository }}/commit/$full_hash) $message"$'\n'
183+
fi
184+
done <<< "$raw_commits"
185+
186+
release_link="[Release ${{ github.ref_name }}](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})"
187+
final_message="$release_link"$'\n\n'"$linked_commits"
173188
else
174-
commits="Initial release"
189+
release_link="[Release ${{ github.ref_name }}](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})"
190+
final_message="$release_link"$'\n\n'"Initial release"
175191
fi
176192
echo "list<<EOF" >> $GITHUB_OUTPUT
177-
echo "$commits" >> $GITHUB_OUTPUT
193+
echo "$final_message" >> $GITHUB_OUTPUT
178194
echo "EOF" >> $GITHUB_OUTPUT
179195
180196
- name: Notify Discord

0 commit comments

Comments
 (0)