From 3de5ee081bb62f0d7c1b69925c240aa64bbbe30a Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 24 Nov 2023 10:05:08 -0700 Subject: [PATCH 1/2] use escape filter --- .github/workflows/deployBlocker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployBlocker.yml b/.github/workflows/deployBlocker.yml index d118b3fee252..ea6dec9c71d7 100644 --- a/.github/workflows/deployBlocker.yml +++ b/.github/workflows/deployBlocker.yml @@ -32,7 +32,7 @@ jobs: channel: '#expensify-open-source', attachments: [{ color: "#DB4545", - text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>'.replace(/[&<>"'|]/g, function(m) { return {'&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '|': '|'}[m]; }), + text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <${{ github.event.issue.html_url }}|${{ github.event.issue.title | escape }}>' }] } env: From 7f2060e5ed6788766146488f6df488b862af0172 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 27 Nov 2023 15:15:25 -0700 Subject: [PATCH 2/2] use sed to replace chars in title --- .github/workflows/deployBlocker.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deployBlocker.yml b/.github/workflows/deployBlocker.yml index ea6dec9c71d7..cb5dc6d28b32 100644 --- a/.github/workflows/deployBlocker.yml +++ b/.github/workflows/deployBlocker.yml @@ -22,6 +22,13 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} + - name: Escape html characters in GH issue title + env: + GH_ISSUE_TITLE: ${{ github.event.issue.title }} + run: | + escaped_title=$(echo "$GH_ISSUE_TITLE" | sed -e 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g; s/|/\|/g') + echo "GH_ISSUE_TITLE=$escaped_title" >> "$GITHUB_ENV" + - name: 'Post the issue in the #expensify-open-source slack room' if: ${{ success() }} uses: 8398a7/action-slack@v3 @@ -32,7 +39,7 @@ jobs: channel: '#expensify-open-source', attachments: [{ color: "#DB4545", - text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <${{ github.event.issue.html_url }}|${{ github.event.issue.title | escape }}>' + text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <${{ github.event.issue.html_url }}|${{ env.GH_ISSUE_TITLE }}>' }] } env: