Skip to content

Commit 79328e4

Browse files
Create main.yml (#846)
* Create main.yml GH actions to post notifications in discord for new issues, PRs and discussions * Add comments on bugs to the trigger
1 parent e1b3bfe commit 79328e4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Discord GitHub Notifications
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
issue_comment:
7+
types: [created]
8+
pull_request:
9+
types: [opened]
10+
discussion:
11+
types: [created]
12+
13+
jobs:
14+
notify-discord:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Set webhook based on event type
18+
id: set-webhook
19+
run: |
20+
if [ "${{ github.event_name }}" == "discussion" ]; then
21+
echo "webhook=${{ secrets.DISCORD_DISCUSSIONS_WEBHOOK }}" >> $GITHUB_OUTPUT
22+
else
23+
echo "webhook=${{ secrets.DISCORD_WEBHOOK }}" >> $GITHUB_OUTPUT
24+
fi
25+
26+
- name: Discord Notification
27+
uses: Ilshidur/action-discord@master
28+
env:
29+
DISCORD_WEBHOOK: ${{ steps.set-webhook.outputs.webhook }}
30+
with:
31+
args: |
32+
${{ github.event_name == 'issues' && format('📣 New issue created: **{0}** by {1} - {2}', github.event.issue.title, github.event.issue.user.login, github.event.issue.html_url) ||
33+
github.event_name == 'issue_comment' && format('💬 New comment on issue **{0}** by {1} - {2}', github.event.issue.title, github.event.comment.user.login, github.event.comment.html_url) ||
34+
github.event_name == 'pull_request' && format('🔄 New PR opened: **{0}** by {1} - {2}', github.event.pull_request.title, github.event.pull_request.user.login, github.event.pull_request.html_url) ||
35+
format('💬 New discussion started: **{0}** by {1} - {2}', github.event.discussion.title, github.event.discussion.user.login, github.event.discussion.html_url) }}

0 commit comments

Comments
 (0)