Skip to content

Commit 4e1e5bd

Browse files
fix: escape variables in release workflow heredoc
1 parent 98a5c33 commit 4e1e5bd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,18 @@ jobs:
4343
# Generate commit list since previous tag
4444
COMMITS=$(git log --pretty=format:"- %s" $PREV_TAG..${{ github.ref_name }})
4545
46-
cat << EOF > release_notes.md
46+
cat << 'EOF' > release_notes.md
4747
## What's Changed
4848

49-
$COMMITS
49+
${COMMITS}
5050

51-
**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREV_TAG...${{ github.ref_name }}
51+
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${{ github.ref_name }}
5252
EOF
53+
# Replace variables in the file
54+
sed -i "s|\${COMMITS}|$COMMITS|g" release_notes.md
55+
sed -i "s|\${{ github.repository }}|${{ github.repository }}|g" release_notes.md
56+
sed -i "s|\${PREV_TAG}|$PREV_TAG|g" release_notes.md
57+
sed -i "s|\${{ github.ref_name }}|${{ github.ref_name }}|g" release_notes.md
5358

5459
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
5560
cat release_notes.md >> $GITHUB_ENV

0 commit comments

Comments
 (0)