Skip to content

Commit

Permalink
escape backticks in create-release action so that they are handled pr…
Browse files Browse the repository at this point in the history
…operly (#13672)

* escape backticks in create-release action so that they are handled properly

* reword comment

* fix typo
  • Loading branch information
lmossman committed Jun 10, 2022
1 parent fe7e1c2 commit 3016172
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/commits/$COMMIT_ID/pulls)
# the printf helps escape characters so that jq can parse the output.
# the sed removes carriage returns so that the body is easier to parse later.
PR_BODY=$(printf '%s' "$PR" | jq '.[0].body' | sed 's/\\r//g')
# The printf helps escape characters so that jq can parse the output.
# The sed removes carriage returns so that the body is easier to parse later, and
# escapes backticks so that they are not executed as commands.
PR_BODY=$(printf '%s' "$PR" | jq '.[0].body' | sed 's/\\r//g' | sed 's/`/\\`/g')
echo ::set-output name=pr_body::${PR_BODY}
- name: Extract Changelog
id: extract_changelog
Expand Down

0 comments on commit 3016172

Please sign in to comment.