Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 8b2890d

Browse files
committed
- update body of the PR that's created to use the .md content instead of .json content
1 parent 13b9286 commit 8b2890d

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

.github/workflows/generate-changeset.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ jobs:
117117
- name: Generate release notes
118118
id: changelog
119119
run: |
120-
# Generate release notes in JSON format for PR body
121-
npm run release:notes -- --format=json > changelog_content.json
122-
123-
# Also generate markdown format for debugging
120+
# Generate release notes in markdown format for PR body
124121
npm run release:notes > changelog_content.md
125122
123+
# Also generate JSON format for debugging
124+
npm run release:notes -- --format=json > changelog_content.json
125+
126126
# Output the changelog for debugging
127127
echo "Generated changelog (markdown format):"
128128
cat changelog_content.md
@@ -157,16 +157,19 @@ jobs:
157157
158158
PR_TITLE=$(echo "$PR_DATA" | jq -r '.title')
159159
160-
# Read the changelog content from JSON file
161-
CHANGELOG_JSON=$(cat changelog_content.json)
162-
163-
# Properly escape the changelog content for JSON
164-
ESCAPED_CHANGELOG=$(echo "$CHANGELOG_JSON" | jq -Rs .)
160+
# Read the changelog content from markdown file and preserve newlines
161+
CHANGELOG_CONTENT=$(cat changelog_content.md)
165162
166-
# Create the JSON payload separately
163+
# Create the JSON payload for the PR body update
164+
# Use jq's @json to properly escape the content
167165
PAYLOAD=$(jq -n \
168-
--arg body "## Upcoming Changes\n\n$(echo $ESCAPED_CHANGELOG | jq -r .)\n\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." \
169-
'{body: $body}')
166+
--arg title "$PR_TITLE" \
167+
--arg body "## Upcoming Changes
168+
169+
$CHANGELOG_CONTENT
170+
171+
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." \
172+
'{title: $title, body: $body}')
170173

171174
# For debugging
172175
echo "API Payload:"
@@ -189,18 +192,20 @@ jobs:
189192
- name: Create new release PR
190193
if: steps.check_pr.outputs.exists == 'false'
191194
run: |
192-
# Read the changelog content from JSON file
193-
CHANGELOG_JSON=$(cat changelog_content.json)
194-
195-
# Properly escape the changelog content for JSON
196-
ESCAPED_CHANGELOG=$(echo "$CHANGELOG_JSON" | jq -Rs .)
195+
# Read the changelog content from markdown file and preserve newlines
196+
CHANGELOG_CONTENT=$(cat changelog_content.md)
197197
198-
# Create the JSON payload separately
198+
# Create the JSON payload for the PR creation
199+
# Use jq's @json to properly escape the content
199200
PAYLOAD=$(jq -n \
200201
--arg title "release: next version 📦" \
201202
--arg head "develop" \
202203
--arg base "main" \
203-
--arg body "## Upcoming Changes\n\n$(echo $ESCAPED_CHANGELOG | jq -r .)\n\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." \
204+
--arg body "## Upcoming Changes
205+
206+
$CHANGELOG_CONTENT
207+
208+
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." \
204209
'{title: $title, head: $head, base: $base, body: $body}')
205210

206211
# For debugging

0 commit comments

Comments
 (0)