Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double-quote handling in release creation workflow #1139

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/create-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,25 @@ jobs:
console.log(`releaseNotes (modified): ${JSON.stringify(modifiedBody, null, 2)}`);
core.setOutput("release_body", modifiedBody);

- name: Prepare Release Title
id: title
env:
# "vX.Y.Z Release Title"
RAW_TITLE: ${{ steps.calculate-version.outputs.new_version }} ${{ github.event.inputs.release_title }}
run: |
# Print RAW_TITLE safely, then escape double quotes
SANITIZED_TITLE="$(printf '%s' "$RAW_TITLE" | sed 's/"/\\"/g')"
echo "sanitized_title=$SANITIZED_TITLE" >> "$GITHUB_OUTPUT"

- name: Write Release Notes to File
run: |
echo "${{ steps.generate-release-notes.outputs.release_body }}" > release-notes.txt

- name: Create Draft Release
run: |
gh release create "${{ steps.calculate-version.outputs.new_version }}" \
--title "${{ steps.calculate-version.outputs.new_version }} ${{ github.event.inputs.release_title }}" \
--notes "${{ steps.generate-release-notes.outputs.release_body }}" \
--title "${{ steps.title.outputs.sanitized_title }}" \
--notes-file release-notes.txt \
--draft \
--repo "${{ github.repository }}"
env:
Expand Down
Loading