From 7e237df2e8313ff281f6fc9c830fdd6facb5c593 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Sun, 2 Feb 2025 15:03:41 -0500 Subject: [PATCH 1/2] Revert "Merge pull request #740 from RooVetGit/discord_fix" This reverts commit e16e1324701e1997034109f866d5a70d45792f3d, reversing changes made to 0e7e5c50bee875b7faba880af76e790d052fb690. --- .github/workflows/discord-pr-notify.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/discord-pr-notify.yml b/.github/workflows/discord-pr-notify.yml index c776ad8630..65e931cf22 100644 --- a/.github/workflows/discord-pr-notify.yml +++ b/.github/workflows/discord-pr-notify.yml @@ -11,14 +11,10 @@ jobs: if: github.head_ref != 'changeset-release/main' steps: - name: Send Discord Notification - env: - PR_TITLE: ${{ github.event.pull_request.title }} - PR_URL: ${{ github.event.pull_request.html_url }} - PR_USER: ${{ github.event.pull_request.user.login }} run: | curl -X POST ${{ secrets.DISCORD_WEBHOOK }} \ -H "Content-Type: application/json" \ -d '{ - "content": "šŸš€ **New PR:** $PR_TITLE\nšŸ”— <$PR_URL>\nšŸ‘¤ **Author:** $PR_USER", - "thread_name": "$PR_TITLE by $PR_USER" + "content": "šŸš€ **New PR:** ${{ github.event.pull_request.title }}\nšŸ”— <${{ github.event.pull_request.html_url }}>\nšŸ‘¤ **Author:** ${{ github.event.pull_request.user.login }}", + "thread_name": "${{ github.event.pull_request.title }} by ${{ github.event.pull_request.user.login }}" }' From 0bcfbd46f32c3f72ff35e9b450c700f69c2b0d6d Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Sun, 2 Feb 2025 15:08:35 -0500 Subject: [PATCH 2/2] Different approach to escaping --- .github/workflows/discord-pr-notify.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/discord-pr-notify.yml b/.github/workflows/discord-pr-notify.yml index 65e931cf22..88c918edfe 100644 --- a/.github/workflows/discord-pr-notify.yml +++ b/.github/workflows/discord-pr-notify.yml @@ -12,9 +12,15 @@ jobs: steps: - name: Send Discord Notification run: | - curl -X POST ${{ secrets.DISCORD_WEBHOOK }} \ + PAYLOAD=$(jq -n \ + --arg title "${{ github.event.pull_request.title }}" \ + --arg url "${{ github.event.pull_request.html_url }}" \ + --arg author "${{ github.event.pull_request.user.login }}" \ + '{ + content: ("šŸš€ **New PR:** " + $title + "\nšŸ”— <" + $url + ">\nšŸ‘¤ **Author:** " + $author), + thread_name: ($title + " by " + $author) + }') + + curl -X POST "${{ secrets.DISCORD_WEBHOOK }}" \ -H "Content-Type: application/json" \ - -d '{ - "content": "šŸš€ **New PR:** ${{ github.event.pull_request.title }}\nšŸ”— <${{ github.event.pull_request.html_url }}>\nšŸ‘¤ **Author:** ${{ github.event.pull_request.user.login }}", - "thread_name": "${{ github.event.pull_request.title }} by ${{ github.event.pull_request.user.login }}" - }' + -d "$PAYLOAD"