Skip to content

Commit 579c1d6

Browse files
authored
escape title and body for release command
1 parent ee9bd31 commit 579c1d6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/create-draft-release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,21 @@ jobs:
106106
console.log(`releaseNotes (modified): ${JSON.stringify(modifiedBody, null, 2)}`);
107107
core.setOutput("release_body", modifiedBody);
108108
109-
- name: Write release notes to file
109+
- name: Prepare Release Title
110+
id: title
111+
run: |
112+
# Escaping double quotes in the title
113+
SANITIZED_TITLE=$(echo "${{ steps.calculate-version.outputs.new_version }} ${{ github.event.inputs.release_title }}" | sed 's/"/\\"/g')
114+
echo "sanitized_title=$SANITIZED_TITLE" >> "$GITHUB_OUTPUT"
115+
116+
- name: Write Release Notes to File
110117
run: |
111118
echo "${{ steps.generate-release-notes.outputs.release_body }}" > release-notes.txt
119+
112120
- name: Create Draft Release
113121
run: |
114122
gh release create "${{ steps.calculate-version.outputs.new_version }}" \
115-
--title "${{ steps.calculate-version.outputs.new_version }} ${{ github.event.inputs.release_title }}" \
123+
--title "${{ steps.title.outputs.sanitized_title }}" \
116124
--notes-file release-notes.txt \
117125
--draft \
118126
--repo "${{ github.repository }}"

0 commit comments

Comments
 (0)