-
-
Notifications
You must be signed in to change notification settings - Fork 8
41 lines (37 loc) · 1.2 KB
/
event.yml
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
33
34
35
36
37
38
39
40
41
name: Create Discord thread
on:
pull_request:
types: [opened]
issues:
types: [opened]
jobs:
send:
name: Open Thread on Discord
runs-on: ubuntu-latest
steps:
- name: Send webhook
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
run: |
if [ "${{ github.event_name }}" == "issues" ]; then
EVENT_URL="${{ github.event.issue.html_url }}"
EVENT_TITLE="${{ github.event.issue.title }}"
elif [ "${{ github.event_name }}" == "pull_request" ]; then
EVENT_URL="${{ github.event.pull_request.html_url }}"
EVENT_TITLE="${{ github.event.pull_request.title }}"
fi
EMBED_JSON=$(jq -n \
--arg title "$EVENT_TITLE" \
--arg url "$EVENT_URL" \
'{
"content": "<@&1265887191922511953>",
"embeds": [{
"title": $title,
"description": "[View issue/pull request](\($url))",
"color": 7506646
}],
"thread_name": "Lumin Framework - \($title)"
'})
curl -X POST -H "Content-Type: application/json" \
-d "$EMBED_JSON" \
$WEBHOOK_URL