@@ -136,9 +136,22 @@ jobs:
136136
137137 - name : Sync to develop
138138 run : |
139- echo "🔄 Creating PR to sync changes to develop branch..."
139+ echo "🔄 Syncing changes to develop branch..."
140140
141- # Create PR directly from main to develop
141+ # Fetch latest develop
142+ git fetch origin develop:develop
143+
144+ # Create sync branch
145+ SYNC_BRANCH="sync/main-to-develop-$(date +%s)"
146+ git checkout -b $SYNC_BRANCH
147+
148+ # Merge main changes
149+ git merge main --no-ff -m "chore: sync version updates from main"
150+
151+ # Push sync branch
152+ git push origin $SYNC_BRANCH
153+
154+ # Create PR
142155 VERSION="${{ steps.version-update.outputs.version }}"
143156
144157 {
@@ -150,15 +163,15 @@ jobs:
150163 echo "Version: **v$VERSION**"
151164 echo ""
152165 echo "### ⚡ Auto-merge"
153- echo "This PR will be merged automatically to keep branches in sync."
166+ echo "This PR should be merged automatically to keep branches in sync."
154167 echo ""
155168 echo "---"
156169 echo "*This PR was automatically created by the version update workflow*"
157170 } > pr-body.md
158171
159172 PR_URL=$(gh pr create \
160173 --base develop \
161- --head main \
174+ --head $SYNC_BRANCH \
162175 --title "🔄 Sync: main → develop (v$VERSION)" \
163176 --body-file pr-body.md \
164177 --label "auto-updated")
@@ -174,9 +187,25 @@ jobs:
174187
175188 - name : Sync to staging
176189 run : |
177- echo "🔄 Creating PR to sync changes to staging branch..."
190+ echo "🔄 Syncing changes to staging branch..."
191+
192+ # Checkout main again
193+ git checkout main
194+
195+ # Fetch latest staging
196+ git fetch origin staging:staging
197+
198+ # Create sync branch
199+ SYNC_BRANCH="sync/main-to-staging-$(date +%s)"
200+ git checkout -b $SYNC_BRANCH
201+
202+ # Merge main changes
203+ git merge main --no-ff -m "chore: sync version updates from main"
204+
205+ # Push sync branch
206+ git push origin $SYNC_BRANCH
178207
179- # Create PR directly from main to staging
208+ # Create PR
180209 VERSION="${{ steps.version-update.outputs.version }}"
181210
182211 {
@@ -188,15 +217,15 @@ jobs:
188217 echo "Version: **v$VERSION**"
189218 echo ""
190219 echo "### ⚡ Auto-merge"
191- echo "This PR will be merged automatically to keep branches in sync."
220+ echo "This PR should be merged automatically to keep branches in sync."
192221 echo ""
193222 echo "---"
194223 echo "*This PR was automatically created by the version update workflow*"
195224 } > pr-body-staging.md
196225
197226 PR_URL=$(gh pr create \
198227 --base staging \
199- --head main \
228+ --head $SYNC_BRANCH \
200229 --title "🔄 Sync: main → staging (v$VERSION)" \
201230 --body-file pr-body-staging.md \
202231 --label "auto-updated")
0 commit comments