Skip to content

Commit bcec998

Browse files
committed
add: discord webhook
1 parent 054b624 commit bcec998

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Discord Commit Notification
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
notify:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Send Discord notification
11+
env:
12+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
13+
run: |
14+
curl -H "Content-Type: application/json" \
15+
-X POST \
16+
-d '{
17+
"username": "GitHub",
18+
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
19+
"embeds": [{
20+
"title": "Changes Deployed",
21+
"url": "https://github.com/${{ github.repository }}/commit/${{ github.sha }}",
22+
"color": 3447003,
23+
"fields": [
24+
{
25+
"name": "Repository",
26+
"value": "[${{ github.repository }}](https://github.com/${{ github.repository }})",
27+
"inline": true
28+
},
29+
{
30+
"name": "Branch",
31+
"value": "`${{ github.ref_name }}`",
32+
"inline": true
33+
},
34+
{
35+
"name": "Author",
36+
"value": "[${{ github.actor }}](https://github.com/${{ github.actor }})",
37+
"inline": true
38+
},
39+
{
40+
"name": "Commit Message",
41+
"value": "${{ github.event.head_commit.message }}"
42+
},
43+
{
44+
"name": "Commit",
45+
"value": "[`${{ github.sha }}`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})"
46+
}
47+
],
48+
"footer": {
49+
"text": "GitHub Actions",
50+
"icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
51+
},
52+
"timestamp": "${{ github.event.head_commit.timestamp }}"
53+
}]
54+
}' \
55+
$DISCORD_WEBHOOK

0 commit comments

Comments
 (0)