-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThread_Creator_Tech_Session.yml
More file actions
32 lines (29 loc) · 1.26 KB
/
Thread_Creator_Tech_Session.yml
File metadata and controls
32 lines (29 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Run Discord Bot
on:
schedule:
- cron: "0 0 * * 3" # 매주 수요일 09:00 (UTC 00:00)
jobs:
run-bot:
runs-on: ubuntu-latest
steps:
- name: Create Tech Session Thread
run: |
thread_name="Topic $(date -d '+6 days' +'%Y-%m-%d')"
response=$(curl -s -w "\n%{http_code}" -H "Authorization: Bot ${{ secrets.TECH_SESSION_THREAD_BOT_TOKEN }}" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"name": "'"${thread_name}"'",
"type": 10,
"auto_archive_duration": 10080
}' \
https://discord.com/api/v10/channels/${{ secrets.DISCORD_CHANNEL_ID_TECH_SESSION }}/threads)
http_body=$(echo "$response" | sed '$d')
http_code=$(echo "$response" | tail -n1)
echo "HTTP Response Body: $http_body"
echo "HTTP Response Code: $http_code"
if [ "$http_code" -ne 200 ] && [ "$http_code" -ne 201 ]; then
echo "Failed to create thread. HTTP Response Code: $http_code"
exit 1
fi
echo "Successfully created thread: $http_body"