Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/notify-discord-pr.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Discord PR Notification

on:
pull_request:
types: [opened]
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review, closed, converted_to_draft]

workflow_dispatch:
inputs:
pr_number:
Expand Down Expand Up @@ -134,7 +135,7 @@ jobs:

# Escape special characters for JSON
PR_TITLE_ESCAPED=$(echo "$PR_TITLE" | sed 's/"/\\"/g' | sed "s/'/\\'/g")

# Create a temporary JSON file using jq to ensure valid JSON
jq -n \
--arg avatar_url "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Discord Notification
name: Discord Release Notification

on:
release:
Expand Down Expand Up @@ -33,18 +33,18 @@ jobs:
else
TAG_NAME=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
fi

# Get release info via GitHub CLI
RELEASE_INFO=$(gh release view "$TAG_NAME" --json name,body,url,author,publishedAt,tagName)

echo "tag_name=$(echo "$RELEASE_INFO" | jq -r '.tagName')" >> $GITHUB_OUTPUT
echo "name=$(echo "$RELEASE_INFO" | jq -r '.name')" >> $GITHUB_OUTPUT

# Use EOF for the body which may contain special characters
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$RELEASE_INFO" | jq -r '.body' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

echo "html_url=$(echo "$RELEASE_INFO" | jq -r '.url')" >> $GITHUB_OUTPUT
echo "author_login=$(echo "$RELEASE_INFO" | jq -r '.author.login')" >> $GITHUB_OUTPUT
echo "author_html_url=https://github.com/$(echo "$RELEASE_INFO" | jq -r '.author.login')" >> $GITHUB_OUTPUT
Expand All @@ -53,12 +53,12 @@ jobs:
# For automatic trigger, use event data
echo "tag_name=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
echo "name=${{ github.event.release.name }}" >> $GITHUB_OUTPUT

# Use EOF for the automatic release body as well
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "${{ github.event.release.body }}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

echo "html_url=${{ github.event.release.html_url }}" >> $GITHUB_OUTPUT
echo "author_login=${{ github.event.release.author.login }}" >> $GITHUB_OUTPUT
echo "author_html_url=${{ github.event.release.author.html_url }}" >> $GITHUB_OUTPUT
Expand Down