@@ -296,20 +296,36 @@ jobs:
296296 gh api -X DELETE "repos/${{ github.repository }}/git/refs/heads/$BRANCH" || true
297297 echo "✅ Branch '$BRANCH' deleted"
298298
299- - name : ' 🔄 Sync develop with main'
299+ - name : ' 🔄 Create PR to sync develop with main'
300+ env :
301+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
300302 run : |
303+ VERSION_TAG="${{ steps.version.outputs.version_tag }}"
304+ SYNC_BRANCH="sync/main-to-develop-${VERSION_TAG}"
305+
301306 git config user.name "github-actions[bot]"
302307 git config user.email "github-actions[bot]@users.noreply.github.com"
303308
304- # Fetch all branches
305- git fetch origin develop:develop || true
306-
307309 # Check if develop branch exists
308- if git show-ref --verify --quiet refs/heads/develop; then
309- git checkout develop
310- git merge main -m "Sync develop with main after release ${{ steps.version.outputs.version_tag }}"
311- git push origin develop
312- echo "✅ develop branch synced with main"
313- else
310+ if ! git ls-remote --heads origin develop | grep -q develop; then
314311 echo "ℹ️ develop branch does not exist, skipping sync"
312+ exit 0
315313 fi
314+
315+ # Create sync branch from main
316+ git checkout -b "$SYNC_BRANCH"
317+ git push origin "$SYNC_BRANCH"
318+
319+ # Create PR to merge into develop
320+ PR_URL=$(gh pr create \
321+ --base develop \
322+ --head "$SYNC_BRANCH" \
323+ --title "Sync develop with main after $VERSION_TAG" \
324+ --body "## 🔄 Sync develop with main
325+
326+ This PR syncs the \`develop\` branch with \`main\` after release **$VERSION_TAG**.
327+
328+ ---
329+ *This PR was automatically generated.*")
330+
331+ echo "✅ Sync PR created: $PR_URL"
0 commit comments