Skip to content

Create Discord thread #3

Create Discord thread

Create Discord thread #3

Workflow file for this run

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 }}
EVENT_TYPE: ${{ github.event_name }}
run: |
if [ "${{ github.event_name }}" == "issues" ]; then
EVENT_URL="${{ github.event.issue.html_url }}"
EVENT_TITLE="${{ github.event.issue.title }}"
EVENT_BODY="${{ github.event.issue.body }}"
elif [ "${{ github.event_name }}" == "pull_request" ]; then
EVENT_URL="${{ github.event.pull_request.html_url }}"
EVENT_TITLE="${{ github.event.pull_request.title }}"
EVENT_BODY="${{ github.event.pull_request.body }}"
fi
curl -X POST -H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "${EVENT_TITLE}",
"url": "${EVENT_URL}",
"description": "${EVENT_BODY}",
}],
"thread_name": "${EVENT_TITLE}"
'} \
$WEBHOOK_URL