Skip to content

Commit a92e518

Browse files
authored
Merge pull request #6 from ez-plugins/@feature/github-discord-action
Added Discord webhook notifications
2 parents bf6a2a6 + 91b7bfa commit a92e518

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Discord Issues & Comments
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
issue_comment:
7+
types: [created]
8+
9+
jobs:
10+
notify:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Send issue or comment to Discord
15+
env:
16+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
17+
run: |
18+
if [[ "${{ github.event_name }}" == "issues" ]]; then
19+
curl -X POST "$DISCORD_WEBHOOK" \
20+
-H "Content-Type: application/json" \
21+
-d '{
22+
"thread_name": "Issue #'${{ github.event.issue.number }}' – '${{ github.event.issue.title }}'",
23+
"embeds": [
24+
{
25+
"title": "🐛 New Issue Opened",
26+
"description": "**'${{ github.event.issue.title }}'**",
27+
"url": "${{ github.event.issue.html_url }}",
28+
"color": 15158332,
29+
"fields": [
30+
{
31+
"name": "Author",
32+
"value": "'${{ github.event.issue.user.login }}'",
33+
"inline": true
34+
},
35+
{
36+
"name": "Repository",
37+
"value": "'${{ github.repository }}'",
38+
"inline": true
39+
}
40+
],
41+
"footer": {
42+
"text": "GitHub Issues"
43+
}
44+
}
45+
]
46+
}'
47+
else
48+
curl -X POST "$DISCORD_WEBHOOK" \
49+
-H "Content-Type: application/json" \
50+
-d '{
51+
"content": "💬 **New comment on Issue #'${{ github.event.issue.number }}'**\n**'${{ github.event.comment.user.login }}'**:\n${{ github.event.comment.body }}\n🔗 ${{ github.event.comment.html_url }}"
52+
}'
53+
fi

0 commit comments

Comments
 (0)