Skip to content

Commit 2176d18

Browse files
authored
Refactor release notes creation to use printf for safer handling of special characters (#355)
1 parent f910fac commit 2176d18

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

.github/workflows/create-tag-on-merge.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,12 @@ jobs:
8080
env:
8181
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8282
run: |
83-
PR_TITLE="${{ steps.should-deploy.outputs.pr-title }}"
84-
RELEASE_NOTES="${{ steps.should-deploy.outputs.release-notes }}"
85-
PR_NUMBER="${{ steps.should-deploy.outputs.pr-number }}"
86-
87-
# Create release notes with PR title, description, and link
88-
cat > release_notes.md << EOF
89-
## What's Changed
90-
91-
${PR_TITLE} in [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER})
92-
93-
${RELEASE_NOTES}
94-
EOF
83+
# Create release notes using printf to handle special characters safely
84+
printf "## What's Changed\n\n%s in [#%s](https://github.com/${{ github.repository }}/pull/%s)\n\n%s\n" \
85+
"${{ steps.should-deploy.outputs.pr-title }}" \
86+
"${{ steps.should-deploy.outputs.pr-number }}" \
87+
"${{ steps.should-deploy.outputs.pr-number }}" \
88+
"${{ steps.should-deploy.outputs.release-notes }}" > release_notes.md
9589
9690
gh release create $NEW_TAG --notes-file release_notes.md
9791
git checkout $NEW_TAG

0 commit comments

Comments
 (0)