Files
windmill/.github/workflows/pr-opened.yml
centdix 62221d81ae internal: Open discord thread when pr is opened (#5733)
* open a thread when pr is opened

* better title

* change secret

* use ubicloud
2025-05-14 15:44:44 +02:00

35 lines
1.0 KiB
YAML

name: "Notify Discord on New PR (with Thread)"
on:
pull_request:
types:
- opened
- ready_for_review
jobs:
discord_notification:
# still guard out any drafts (just in case)
if: github.event.pull_request.draft == false
runs-on: ubicloud-standard-2
steps:
- name: Send Discord notification and start a thread
env:
WEBHOOK_URL: ${{ secrets.DISCORD_PR_REVIEWS_WEBHOOK }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
payload=$(jq -n \
--arg content "${PR_URL}" \
--arg thread "$PR_TITLE by \`${PR_AUTHOR}\`" \
'{
content: $content,
thread_name: $thread,
auto_archive_duration: 10080
}'
)
curl -H "Content-Type: application/json" \
-X POST \
--data "$payload" \
"$WEBHOOK_URL"