Skip to content

Commit 0fd2a96

Browse files
committed
Even more robust sanitization
1 parent d15a2dd commit 0fd2a96

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,19 @@ jobs:
145145

146146
- name: Prepare Final Changelog
147147
id: changelog
148-
# Pass the multi-line content safely via an environment variable
148+
# Add this 'env' block to safely load the changelogs as environment variables
149149
env:
150-
CHANGELOG_CONTENT: ${{ steps.git-cliff.outputs.content }}
150+
RELEASE_NOTES: ${{ inputs.release-changelog }}
151+
DEV_NOTES: ${{ steps.git-cliff.outputs.content }}
151152
run: |
152153
NOTES=""
153154
if [[ "${{ inputs.is-release-build }}" == "true" ]]; then
154-
# Use the release changelog if this is a release build
155-
NOTES="${{ inputs.release-changelog }}"
155+
# Use the environment variable for the release changelog.
156+
# The double quotes are critical to preserve newlines!
157+
NOTES="$RELEASE_NOTES"
156158
else
157-
# Otherwise, use the content from the environment variable.
158-
# It's crucial to quote it to preserve newlines.
159-
NOTES="$CHANGELOG_CONTENT"
159+
# Use the environment variable for the dev changelog.
160+
NOTES="$DEV_NOTES"
160161
fi
161162
162163
if [ -z "$NOTES" ]; then
@@ -169,7 +170,6 @@ jobs:
169170
echo "$NOTES"
170171
echo "EOF"
171172
} >> "$GITHUB_OUTPUT"
172-
173173
#------------------------------------------------------------------
174174
# Publish to Modrinth & API
175175
#------------------------------------------------------------------

0 commit comments

Comments
 (0)