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 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
141
+
# Create PR with a special tag in the body to identify it later
153
142
gh pr create --base next --head next-port-pr${{ github.event.pull_request.number }} \
154
143
--title "[Port to next] ${{ github.event.pull_request.title }}" \
155
-
--body-file $PR_BODY_FILE
156
-
157
-
# Clean up
158
-
rm $PR_BODY_FILE
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 -->"
159
145
env:
160
146
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
161
147
@@ -265,18 +251,7 @@ EOF
265
251
echo "Updating existing PR #$EXISTING_PR with latest merged changes"
266
252
267
253
# Add comment explaining the update
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.
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."
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
-
298
265
# Create the new PR first
299
266
NEW_PR=$(gh pr create --base next --head $BRANCH_NAME \
300
267
--title "[Merged-sync] $PR_TITLE" \
301
-
--body-file $PR_BODY_FILE \
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." \
302
269
--json number --jq '.number')
303
270
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
-
310
271
# Now close the existing PR with a reference to the new one
311
-
gh pr close $EXISTING_PR --comment-file $COMMENT_FILE
312
-
313
-
# Clean up
314
-
rm $PR_BODY_FILE
315
-
rm $COMMENT_FILE
272
+
gh pr close $EXISTING_PR --comment "This PR is replaced by the direct synchronization of the merge commit in #$NEW_PR"
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
-
333
282
# Create new PR
334
283
gh pr create --base next --head $BRANCH_NAME \
335
284
--title "[Merged-sync] $PR_TITLE" \
336
-
--body-file $PR_BODY_FILE
337
-
338
-
# Clean up
339
-
rm $PR_BODY_FILE
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."
340
286
env:
341
287
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
342
288
@@ -384,21 +330,10 @@ EOF
384
330
if git cherry-pick $COMMIT_HASH; then
385
331
git push origin $BRANCH_NAME
386
332
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