Skip to content

Commit 6cebc7d

Browse files
authored
Create notify_discord.yaml
1 parent 5a1decc commit 6cebc7d

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# .github/workflows/notify_discord.yaml
2+
name: Notify Discord After Dashboard Update
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "_MonthlyChallenges/DASHBOARD.md"
10+
11+
jobs:
12+
notify_discord:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
ref: main
20+
21+
- name: Send Dashboard to Discord
22+
working-directory: _MonthlyChallenges
23+
run: |
24+
DASHBOARD_CONTENT=$(jq -R -s '.' DASHBOARD.md)
25+
EMBED_JSON=$(cat <<EOF
26+
{
27+
"content": "",
28+
"embeds": [
29+
{
30+
"author": {
31+
"name": "Allumbus🔥",
32+
"url": "https://github.com/AlgorithmStudy-Allumbus",
33+
"icon_url": "https://imgur.com/kKJg6v3.jpg"
34+
},
35+
"title": "**📊 챌린지 진행 상황**",
36+
"url": "https://github.com/AlgorithmStudy-Allumbus/codingtest_algorithm_study/blob/main/_MonthlyChallenges/DASHBOARD.md",
37+
"description": ${DASHBOARD_CONTENT},
38+
"color": 15258703,
39+
"footer": {
40+
"text": "Updated on $(date '+%Y-%m-%d %H:%M:%S')"
41+
}
42+
}
43+
]
44+
}
45+
EOF
46+
)
47+
curl -v -H "Content-Type: application/json" \
48+
-X POST \
49+
-d "$EMBED_JSON" \
50+
"${{ secrets.DISCORD_WEBHOOK_URL }}"

0 commit comments

Comments
 (0)