diff --git a/.github/workflows/notify-discord-pr.yml b/.github/workflows/notify-discord-pr.yml index 6c29ece3..e5b565fb 100644 --- a/.github/workflows/notify-discord-pr.yml +++ b/.github/workflows/notify-discord-pr.yml @@ -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: @@ -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" \ diff --git a/.github/workflows/notify-discord.yml b/.github/workflows/notify-discord-release.yml similarity index 98% rename from .github/workflows/notify-discord.yml rename to .github/workflows/notify-discord-release.yml index 101d98f6..21a0a257 100644 --- a/.github/workflows/notify-discord.yml +++ b/.github/workflows/notify-discord-release.yml @@ -1,4 +1,4 @@ -name: Discord Notification +name: Discord Release Notification on: release: @@ -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<> $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 @@ -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<> $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