Skip to content

Commit adc3d9c

Browse files
committed
Revert "New smarter approach for sync-content-to-next.yml"
This reverts commit bcfd3de.
1 parent 7242386 commit adc3d9c

File tree

1 file changed

+7
-72
lines changed

1 file changed

+7
-72
lines changed

.github/workflows/sync-content-to-next.yml

+7-72
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,10 @@ jobs:
138138
# Push branch
139139
git push origin next-port-pr${{ github.event.pull_request.number }}
140140
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
141+
# Create PR with a special tag in the body to identify it later
153142
gh pr create --base next --head next-port-pr${{ github.event.pull_request.number }} \
154143
--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 -->"
159145
env:
160146
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
161147

@@ -265,18 +251,7 @@ EOF
265251
echo "Updating existing PR #$EXISTING_PR with latest merged changes"
266252
267253
# 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.
273-
EOF
274-
275-
# Add comment using the file
276-
gh pr comment $EXISTING_PR --body-file $COMMENT_FILE
277-
278-
# Clean up
279-
rm $COMMENT_FILE
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."
280255
env:
281256
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
282257

@@ -287,32 +262,14 @@ EOF
287262
BRANCH_NAME="${{ steps.create-branch.outputs.branch_name }}"
288263
PR_TITLE="${{ github.event.pull_request.title }}"
289264
290-
# Create PR body file
291-
PR_BODY_FILE=$(mktemp)
292-
cat > $PR_BODY_FILE << EOF
293-
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-
298265
# Create the new PR first
299266
NEW_PR=$(gh pr create --base next --head $BRANCH_NAME \
300267
--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." \
302269
--json number --jq '.number')
303270
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-
310271
# 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"
316273
env:
317274
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
318275

@@ -322,21 +279,10 @@ EOF
322279
BRANCH_NAME="${{ steps.create-branch.outputs.branch_name }}"
323280
PR_TITLE="${{ github.event.pull_request.title }}"
324281
325-
# Create PR body file
326-
PR_BODY_FILE=$(mktemp)
327-
cat > $PR_BODY_FILE << EOF
328-
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-
333282
# Create new PR
334283
gh pr create --base next --head $BRANCH_NAME \
335284
--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."
340286
env:
341287
GITHUB_TOKEN: ${{ secrets.SYNC_MAIN_TO_NEXT }}
342288

@@ -384,21 +330,10 @@ EOF
384330
if git cherry-pick $COMMIT_HASH; then
385331
git push origin $BRANCH_NAME
386332
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.
393-
EOF
394-
395333
# Create PR
396334
gh pr create --base next --head $BRANCH_NAME \
397335
--title "[Auto-sync] $COMMIT_MSG" \
398-
--body-file $PR_BODY_FILE
399-
400-
# Clean up
401-
rm $PR_BODY_FILE
336+
--body "Automatic sync of commit from main"
402337
else
403338
echo "Cherry-pick failed, manual intervention needed"
404339
git cherry-pick --abort

0 commit comments

Comments
 (0)