You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Create PR with a special tag in the body to identify it later
141
+
# Create PR body in a temp file to preserve newlines
142
+
PR_BODY_FILE=$(mktemp)
143
+
cat > $PR_BODY_FILE << EOF
144
+
Automatic port of PR #${{ github.event.pull_request.number }} to next branch.
145
+
146
+
Original PR: #${{ github.event.pull_request.number }}
147
+
Created automatically after adding the 'temp - port to docs-next' label.
148
+
149
+
<!-- SYNC_PR_MARKER -->
150
+
EOF
151
+
152
+
# Create PR using the file for body content
142
153
gh pr create --base next --head next-port-pr${{ github.event.pull_request.number }} \
143
154
--title "[Port to next] ${{ github.event.pull_request.title }}" \
144
-
--body "Automatic port of PR #${{ github.event.pull_request.number }} to next branch.\n\nOriginal PR: #${{ github.event.pull_request.number }}\nCreated automatically after adding the 'temp - port to docs-next' label.\n\n<!-- SYNC_PR_MARKER -->"
155
+
--body-file $PR_BODY_FILE
156
+
157
+
# Clean up
158
+
rm $PR_BODY_FILE
145
159
env:
146
160
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
147
161
@@ -251,7 +265,18 @@ jobs:
251
265
echo "Updating existing PR #$EXISTING_PR with latest merged changes"
252
266
253
267
# Add comment explaining the update
254
-
gh pr comment $EXISTING_PR --body "This PR has been updated with the latest changes from the merged PR #${{ github.event.pull_request.number }}. The merge commit was cherry-picked to include all approved changes."
268
+
COMMENT_FILE=$(mktemp)
269
+
cat > $COMMENT_FILE << EOF
270
+
This PR has been updated with the latest changes from the merged PR #${{ github.event.pull_request.number }}.
271
+
272
+
The merge commit was cherry-picked to include all approved changes.
Synchronization of merged PR #${{ github.event.pull_request.number }} to next branch.
294
+
295
+
This PR contains the final state of the changes as they were merged to main.
296
+
EOF
297
+
265
298
# Create the new PR first
266
299
NEW_PR=$(gh pr create --base next --head $BRANCH_NAME \
267
300
--title "[Merged-sync] $PR_TITLE" \
268
-
--body "Synchronization of merged PR #${{ github.event.pull_request.number }} to next branch. This PR contains the final state of the changes as they were merged to main." \
301
+
--body-file $PR_BODY_FILE \
269
302
--json number --jq '.number')
270
303
304
+
# Create comment body file
305
+
COMMENT_FILE=$(mktemp)
306
+
cat > $COMMENT_FILE << EOF
307
+
This PR is replaced by the direct synchronization of the merge commit in #$NEW_PR
308
+
EOF
309
+
271
310
# Now close the existing PR with a reference to the new one
272
-
gh pr close $EXISTING_PR --comment "This PR is replaced by the direct synchronization of the merge commit in #$NEW_PR"
311
+
gh pr close $EXISTING_PR --comment-file $COMMENT_FILE
Synchronization of merged PR #${{ github.event.pull_request.number }} to next branch.
329
+
330
+
This PR contains the final state of the changes as they were merged to main.
331
+
EOF
332
+
282
333
# Create new PR
283
334
gh pr create --base next --head $BRANCH_NAME \
284
335
--title "[Merged-sync] $PR_TITLE" \
285
-
--body "Synchronization of merged PR #${{ github.event.pull_request.number }} to next branch. This PR contains the final state of the changes as they were merged to main."
336
+
--body-file $PR_BODY_FILE
337
+
338
+
# Clean up
339
+
rm $PR_BODY_FILE
286
340
env:
287
341
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
288
342
@@ -330,10 +384,21 @@ jobs:
330
384
if git cherry-pick $COMMIT_HASH; then
331
385
git push origin $BRANCH_NAME
332
386
387
+
# Create PR body file
388
+
PR_BODY_FILE=$(mktemp)
389
+
cat > $PR_BODY_FILE << EOF
390
+
Automatic sync of commit from main.
391
+
392
+
This PR contains changes pushed directly to the main branch.
0 commit comments