Skip to content

Commit 3ccaf16

Browse files
committed
✨ Adds Discord notifications for bug issues
Adds a new workflow to send notifications to Discord when a new "Bug" type issue is opened. Significant changes include: - Creates a new workflow file for issue notifications. - Configures the workflow to trigger on issue creation events, specifically for issues labeled as "Bug". - Implements a step to send a formatted message to a Discord channel using a webhook URL. - Includes the issue title, author, link, and a truncated description in the Discord message. - Deletes the AI code review workflow
1 parent e9ccff5 commit 3ccaf16

File tree

2 files changed

+52
-126
lines changed

2 files changed

+52
-126
lines changed

.github/workflows/ai-code-review.yml

Lines changed: 0 additions & 126 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Report Bug-type issues to Discord
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
notify_discord:
9+
runs-on: ubuntu-latest
10+
11+
# Only run for issues whose type is "Bug"
12+
if: github.event.issue.issue_type == 'Bug'
13+
14+
steps:
15+
- name: Send Discord notification
16+
env:
17+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
18+
ISSUE_TITLE: ${{ github.event.issue.title }}
19+
ISSUE_URL: ${{ github.event.issue.html_url }}
20+
ISSUE_NUMBER: ${{ github.event.issue.number }}
21+
ISSUE_BODY: ${{ github.event.issue.body }}
22+
ISSUE_USER: ${{ github.event.issue.user.login }}
23+
REPO_NAME: ${{ github.repository }}
24+
run: |
25+
# Trim body to avoid huge messages
26+
SHORT_BODY=$(printf '%s' "$ISSUE_BODY" | head -c 400)
27+
[ -z "$SHORT_BODY" ] && SHORT_BODY="(no description)"
28+
29+
# Build JSON payload for Discord
30+
payload=$(jq -n \
31+
--arg username "GitHub Bot" \
32+
--arg content "" \
33+
--arg title "🐛 New Bug issue in $REPO_NAME" \
34+
--arg desc "**#${ISSUE_NUMBER} – $ISSUE_TITLE**\n"\
35+
"**Author:** $ISSUE_USER\n"\
36+
"**Link:** $ISSUE_URL\n\n"\
37+
"**Description (truncated):**\n$SHORT_BODY" \
38+
'{
39+
"username": $username,
40+
"content": $content,
41+
"embeds": [
42+
{
43+
"title": $title,
44+
"description": $desc
45+
}
46+
]
47+
}')
48+
49+
curl -X POST \
50+
-H "Content-Type: application/json" \
51+
-d "$payload" \
52+
"$DISCORD_WEBHOOK_URL"

0 commit comments

Comments
 (0)