Skip to content

Commit b00ff68

Browse files
committed
no message
1 parent 349076e commit b00ff68

File tree

1 file changed

+35
-24
lines changed

1 file changed

+35
-24
lines changed

.github/workflows/generate-changeset.yml

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -175,22 +175,29 @@ jobs:
175175
176176
PR_TITLE=$(echo "$PR_DATA" | jq -r '.title')
177177
178-
# Create the PR body with proper formatting
179-
PR_BODY="## Upcoming Changes"
180-
PR_BODY="${PR_BODY}"$'\n\n'
181-
PR_BODY="${PR_BODY}$(cat /tmp/release-notes/temp_notes.md)"
182-
183-
# Add @since updates section if there are any
178+
# Create the PR body using heredoc to preserve special characters
179+
cat > /tmp/pr_body.md << 'EOL'
180+
## Upcoming Changes
181+
182+
$(cat /tmp/release-notes/temp_notes.md)
183+
EOL
184+
185+
# Add @since updates section if there are any, using printf to handle special characters
184186
if [[ "${{ steps.check_since.outputs.has_updates }}" == "true" ]]; then
185-
PR_BODY="${PR_BODY}"$'\n\n'
186-
PR_BODY="${PR_BODY}${{ steps.check_since.outputs.summary }}"
187+
printf "\n\n%s\n" "${{ steps.check_since.outputs.summary }}" >> /tmp/pr_body.md
187188
fi
188189
189-
PR_BODY="${PR_BODY}"$'\n\n'
190-
PR_BODY="${PR_BODY}This PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch."
190+
# Add the footer
191+
echo -e "\nThis PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch." >> /tmp/pr_body.md
191192
192-
# Use jq to properly escape the content
193-
PAYLOAD=$(jq -n --arg body "$PR_BODY" --arg title "$PR_TITLE" '{body: $body, title: $title}')
193+
# Read the complete PR body and escape it for JSON
194+
PR_BODY=$(cat /tmp/pr_body.md)
195+
196+
# Use jq to properly escape the content for JSON
197+
PAYLOAD=$(jq -n \
198+
--arg body "$PR_BODY" \
199+
--arg title "$PR_TITLE" \
200+
'{body: $arg.body, title: $arg.title}')
194201
195202
# For debugging
196203
echo "API Payload:"
@@ -213,27 +220,31 @@ jobs:
213220
- name: Create new release PR
214221
if: steps.check_pr.outputs.exists == 'false'
215222
run: |
216-
# Create the PR body with proper formatting
217-
PR_BODY="## Upcoming Changes"
218-
PR_BODY="${PR_BODY}"$'\n\n'
219-
PR_BODY="${PR_BODY}$(cat /tmp/release-notes/temp_notes.md)"
220-
221-
# Add @since updates section if there are any
223+
# Create the PR body using heredoc to preserve special characters
224+
cat > /tmp/pr_body.md << 'EOL'
225+
## Upcoming Changes
226+
227+
$(cat /tmp/release-notes/temp_notes.md)
228+
EOL
229+
230+
# Add @since updates section if there are any, using printf to handle special characters
222231
if [[ "${{ steps.check_since.outputs.has_updates }}" == "true" ]]; then
223-
PR_BODY="${PR_BODY}"$'\n\n'
224-
PR_BODY="${PR_BODY}${{ steps.check_since.outputs.summary }}"
232+
printf "\n\n%s\n" "${{ steps.check_since.outputs.summary }}" >> /tmp/pr_body.md
225233
fi
226234
227-
PR_BODY="${PR_BODY}"$'\n\n'
228-
PR_BODY="${PR_BODY}This PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch."
235+
# Add the footer
236+
echo -e "\nThis PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch." >> /tmp/pr_body.md
237+
238+
# Read the complete PR body and escape it for JSON
239+
PR_BODY=$(cat /tmp/pr_body.md)
229240
230-
# Use jq to properly escape the content
241+
# Use jq to properly escape the content for JSON
231242
PAYLOAD=$(jq -n \
232243
--arg title "release: next version 📦" \
233244
--arg head "develop" \
234245
--arg base "main" \
235246
--arg body "$PR_BODY" \
236-
'{title: $title, head: $head, base: $base, body: $body}')
247+
'{title: $arg.title, head: $arg.head, base: $arg.base, body: $arg.body}')
237248
238249
# For debugging
239250
echo "API Payload:"

0 commit comments

Comments
 (0)