Skip to content

Commit 0ecc240

Browse files
committed
Discord Chats connections added
1 parent d3ff14e commit 0ecc240

3 files changed

Lines changed: 87 additions & 2 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# .github/workflows/discord_issue_notifier.yml
2+
3+
name: Discord Issue Notifier
4+
5+
# This action will only trigger when a new issue is "opened".
6+
on:
7+
issues:
8+
types: [opened]
9+
10+
jobs:
11+
notify:
12+
name: Send Issue Notification
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Send Issue Info to Discord
16+
env:
17+
# We securely access the same webhook URL from the GitHub secret.
18+
DISCORD_WEBHOOK_URL_2: ${{ secrets.DISCORD_WEBHOOK_URL_2 }}
19+
run: |
20+
# This curl command sends a new embed, formatted for issues.
21+
curl -X POST "$DISCORD_WEBHOOK_URL_2" \
22+
-H "Content-Type: application/json" \
23+
-d @- << EOF
24+
{
25+
"username": "GitHub Issues",
26+
"avatar_url": "https://github.com/github.png",
27+
"embeds": [
28+
{
29+
"title": "🛠️ New Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }}",
30+
"url": "${{ github.event.issue.html_url }}",
31+
"description": "Opened by **${{ github.event.issue.user.login }}**. Click the title to view the full issue.",
32+
"color": 15158332,
33+
"footer": {
34+
"text": "JsWeb Framework"
35+
}
36+
}
37+
]
38+
}
39+
EOF

.github/workflows/discord_release_notifier.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
-H "Content-Type: application/json" \
2323
-d @- << EOF
2424
{
25-
"username": "JsWeb Releases",
26-
"avatar_url": "https://github.com/Jones-peter/jsweb/blob/main/images/jsweb_logo_bg.png?raw=true",
25+
"username": "Github Releases",
26+
"avatar_url": "https://github.com/github.png",
2727
"embeds": [
2828
{
2929
"title": "🚀 New Release: ${{ github.event.release.name }}",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# .github/workflows/stargazer_notifier.yml
2+
3+
name: Discord Stargazer Notifier
4+
5+
# This action triggers when someone stars the repository.
6+
on:
7+
watch:
8+
types: [started]
9+
10+
jobs:
11+
notify:
12+
name: Send Star Notification
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Send Star Info to Discord
16+
env:
17+
DISCORD_WEBHOOK_URL_3: ${{ secrets.DISCORD_WEBHOOK_URL_3 }}
18+
SENDER_LOGIN: ${{ github.event.sender.login }}
19+
SENDER_URL: ${{ github.event.sender.html_url }}
20+
REPO_NAME: ${{ github.repository }}
21+
STAR_COUNT: ${{ github.event.repository.stargazers_count }}
22+
run: |
23+
# Use jq to safely build the JSON payload.
24+
json_payload=$(jq -n \
25+
--arg username "New Star!" \
26+
--arg avatar_url "https://github.com/github.png" \
27+
--arg description "[$SENDER_LOGIN]($SENDER_URL) just starred **$REPO_NAME**!" \
28+
--arg star_count "$STAR_COUNT" \
29+
'{
30+
"username": $username,
31+
"avatar_url": $avatar_url,
32+
"embeds": [
33+
{
34+
"title": "🌟 New Star!",
35+
"description": $description,
36+
"color": 16705372,
37+
"footer": {
38+
"text": "Total Stars: \($star_count)"
39+
}
40+
}
41+
]
42+
}')
43+
44+
curl -X POST "$DISCORD_WEBHOOK_URL_3" \
45+
-H "Content-Type: application/json" \
46+
-d "$json_payload"

0 commit comments

Comments
 (0)