From fdac0f310d18c737409ce89d8a11f95e1c1bd98a Mon Sep 17 00:00:00 2001 From: Madison Swain-Bowden Date: Wed, 24 Jan 2024 18:02:38 -0800 Subject: [PATCH] Wrap PR and discussion titles in `toJSON` to escape them in Slack (#3699) --- .github/workflows/discussion_ping.yml | 2 +- .github/workflows/pr_ping.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/discussion_ping.yml b/.github/workflows/discussion_ping.yml index ed183b6797c..1305cebdaf7 100644 --- a/.github/workflows/discussion_ping.yml +++ b/.github/workflows/discussion_ping.yml @@ -13,7 +13,7 @@ jobs: env: discussion_url: ${{ github.event.discussion.html_url }} discussion_number: ${{ github.event.discussion.number }} - discussion_title: ${{ github.event.discussion.title }} + discussion_title: ${{ toJSON(github.event.discussion.title) }} discussion_author: ${{ github.event.discussion.user.login }} discussion_repo: ${{ github.event.repository.full_name }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/pr_ping.yml b/.github/workflows/pr_ping.yml index f234cf5245b..fa791839b06 100644 --- a/.github/workflows/pr_ping.yml +++ b/.github/workflows/pr_ping.yml @@ -17,7 +17,7 @@ jobs: env: pr_url: ${{ github.event.pull_request.html_url }} pr_number: ${{ github.event.pull_request.number }} - pr_title: ${{ github.event.pull_request.title }} + pr_title: ${{ toJSON(github.event.pull_request.title) }} pr_author: ${{ github.event.pull_request.user.login }} pr_repo: ${{ github.event.pull_request.base.repo.full_name }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} @@ -33,7 +33,7 @@ jobs: with: payload: | { - "text": "New ${{ env.pr_status }} PR opened by ${{ env.pr_author }} in ${{ env.pr_repo }}: #${{ env.pr_number }} - ${{ env.pr_title }}", + "text": "New${{ env.pr_status }}PR opened by ${{ env.pr_author }} in ${{ env.pr_repo }}: #${{ env.pr_number }} - ${{ env.pr_title }}", "blocks": [ { "type": "section",