mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
Update and rename archive-discord-thread.yml to delete-discord-thread.yml
This commit is contained in:
28
.github/workflows/delete-discord-thread.yml
vendored
Normal file
28
.github/workflows/delete-discord-thread.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Delete Discord Thread on GitHub Issue Closure
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
close_discord_thread:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Get thread-ID op and close thread
|
||||
run: |
|
||||
ISSUE_TITLE="${{ github.event.issue.title }}"
|
||||
|
||||
THREAD_ID=$(curl -s -X GET "https://discord.com/api/v10/guilds/${{ secrets.DISCORD_GUILD_ID }}/threads/active" \
|
||||
-H "Authorization: Bot ${{ secrets.DISCORD_BOT_TOKEN }}" \
|
||||
-H "Content-Type: application/json" | \
|
||||
jq -r --arg TITLE "$ISSUE_TITLE" '.threads[] | select(.parent_id == "${{ secrets.DISCORD_CHANNEL_ID }}" and .name == ("Wanted Tester for " + $TITLE)) | .id')
|
||||
|
||||
if [ -n "$THREAD_ID" ]; then
|
||||
echo "Thread found: $THREAD_ID. Archiving..."
|
||||
curl -X DELETE "https://discord.com/api/v10/channels/$THREAD_ID" \
|
||||
-H "Authorization: Bot ${{ secrets.DISCORD_BOT_TOKEN }}"
|
||||
else
|
||||
echo "No thread found for issue: $ISSUE_TITLE"
|
||||
fi
|
||||
Reference in New Issue
Block a user