Skip to content

Commit d5c99d4

Browse files
committed
Refactor release creation to use temporary notes file and improve placeholder handling
1 parent b30ab5a commit d5c99d4

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,29 @@ jobs:
113113
- name: Create Release
114114
id: create_release
115115
run: |
116-
gh release create "${{ steps.new_version.outputs.new_version }}" \
117-
--title "Release ${{ steps.new_version.outputs.new_version }}" \
118-
--notes "$(cat <<EOF
116+
NOTES_FILE="$(mktemp)"
117+
118+
cat > "$NOTES_FILE" <<'EOF'
119119
## What's Changed
120120
121121
Auto-generated release from main branch.
122122
123123
**Commits included:**
124-
\`\`\`
125-
$COMMIT_MESSAGE
126-
\`\`\`
124+
```
125+
__COMMITS_HERE__
126+
```
127127
128128
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version_bump.outputs.current_version }}...${{ steps.new_version.outputs.new_version }}
129129
EOF
130-
)"
131-
echo "tag_name=${{ steps.new_version.outputs.new_version }}" >> $GITHUB_OUTPUT
130+
131+
# Replace placeholder with the commit message safely (no shell expansion)
132+
perl -0777 -pe 's/__COMMITS_HERE__/\Q$ENV{COMMIT_MESSAGE}\E/g' -i "$NOTES_FILE"
133+
134+
gh release create "${{ steps.new_version.outputs.new_version }}" \
135+
--title "Release ${{ steps.new_version.outputs.new_version }}" \
136+
--notes-file "$NOTES_FILE"
137+
138+
echo "tag_name=${{ steps.new_version.outputs.new_version }}" >> "$GITHUB_OUTPUT"
132139
env:
133140
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134141
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}

0 commit comments

Comments
 (0)