Skip to content

Commit cca3b33

Browse files
committed
Improve Discord notification formatting with emojis and cleaner layout
1 parent 1ca3179 commit cca3b33

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

.github/workflows/discord-activity.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
run: |
1414
EVENT='${{ toJSON(github.event) }}'
1515
COUNT=$(jq -r '.commits | length' <<< "$EVENT")
16-
REF=$(jq -r '.ref' <<< "$EVENT")
16+
REF=$(jq -r '.ref' <<< "$EVENT" | sed 's|refs/heads/||')
1717
COMPARE=$(jq -r '.compare' <<< "$EVENT")
1818
1919
# List every commit (one line per commit)
2020
COMMITS=$(jq -r '.commits[]
21-
| "- " + (.message | gsub("\\r?\\n"; " "))
22-
+ " (" + .id[0:7] + ") by " + .author.name' <<< "$EVENT")
21+
| " " + (.message | gsub("\\r?\\n"; " "))
22+
+ " [`" + .id[0:7] + "`] by " + .author.name' <<< "$EVENT")
2323
2424
{
2525
echo "COUNT=$COUNT"
@@ -36,8 +36,13 @@ jobs:
3636
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
3737
with:
3838
args: >
39-
[${{ github.repository }}] push by ${{ github.actor }}
40-
• Ref: ${{ env.REF }}
41-
• ${{ env.COUNT }} commit(s):
39+
🚀 **Push Event**
40+
📦 Repository: `${{ github.repository }}`
41+
👤 Author: `${{ github.actor }}`
42+
🌿 Branch: `${{ env.REF }}`
43+
📝 Commits: `${{ env.COUNT }}`
44+
45+
**Commit List:**
4246
${{ env.COMMITS }}
43-
• Diff: ${{ env.COMPARE }}
47+
48+
🔗 [View Diff](${{ env.COMPARE }})

0 commit comments

Comments
 (0)