Skip to content

Commit 6212efc

Browse files
committed
fix: simplify sync workflow with direct push
- Remove unnecessary PR creation for develop/staging sync - Push directly to develop and staging branches - No branch protection rules on these branches - Much simpler and faster synchronization
1 parent 902999d commit 6212efc

File tree

1 file changed

+10
-79
lines changed

1 file changed

+10
-79
lines changed

.github/workflows/update-version.yml

Lines changed: 10 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -138,104 +138,35 @@ jobs:
138138
run: |
139139
echo "🔄 Syncing changes to develop branch..."
140140
141-
# Fetch latest develop
141+
# Fetch and checkout develop
142142
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
143+
git checkout develop
147144
148145
# Merge main changes
149146
git merge main --no-ff -m "chore: sync version updates from main"
150147
151-
# Push sync branch
152-
git push origin $SYNC_BRANCH
153-
154-
# Create PR
155-
VERSION="${{ steps.version-update.outputs.version }}"
156-
157-
{
158-
echo "## 🔄 Version Sync from Main"
159-
echo ""
160-
echo "### 📦 Updated Versions"
161-
echo "This PR syncs the stable version updates from main to develop."
162-
echo ""
163-
echo "Version: **v$VERSION**"
164-
echo ""
165-
echo "### ⚡ Auto-merge"
166-
echo "This PR should be merged automatically to keep branches in sync."
167-
echo ""
168-
echo "---"
169-
echo "*This PR was automatically created by the version update workflow*"
170-
} > pr-body.md
171-
172-
PR_URL=$(gh pr create \
173-
--base develop \
174-
--head $SYNC_BRANCH \
175-
--title "🔄 Sync: main → develop (v$VERSION)" \
176-
--body-file pr-body.md \
177-
--label "auto-updated")
178-
179-
# Extract PR number from URL
180-
PR_NUMBER=$(echo $PR_URL | grep -oE '[0-9]+$')
148+
# Push directly to develop
149+
git push origin develop
181150
182-
# Enable auto-merge
183-
echo "Enabling auto-merge for PR #$PR_NUMBER..."
184-
gh pr merge $PR_NUMBER --auto --merge
151+
echo "✅ Successfully synced main to develop"
185152
env:
186153
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
187154

188155
- name: Sync to staging
189156
run: |
190157
echo "🔄 Syncing changes to staging branch..."
191158
192-
# Checkout main again
193-
git checkout main
194-
195-
# Fetch latest staging
159+
# Fetch and checkout staging
196160
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
161+
git checkout staging
201162
202163
# Merge main changes
203164
git merge main --no-ff -m "chore: sync version updates from main"
204165
205-
# Push sync branch
206-
git push origin $SYNC_BRANCH
207-
208-
# Create PR
209-
VERSION="${{ steps.version-update.outputs.version }}"
210-
211-
{
212-
echo "## 🔄 Version Sync from Main"
213-
echo ""
214-
echo "### 📦 Updated Versions"
215-
echo "This PR syncs the stable version updates from main to staging."
216-
echo ""
217-
echo "Version: **v$VERSION**"
218-
echo ""
219-
echo "### ⚡ Auto-merge"
220-
echo "This PR should be merged automatically to keep branches in sync."
221-
echo ""
222-
echo "---"
223-
echo "*This PR was automatically created by the version update workflow*"
224-
} > pr-body-staging.md
225-
226-
PR_URL=$(gh pr create \
227-
--base staging \
228-
--head $SYNC_BRANCH \
229-
--title "🔄 Sync: main → staging (v$VERSION)" \
230-
--body-file pr-body-staging.md \
231-
--label "auto-updated")
232-
233-
# Extract PR number from URL
234-
PR_NUMBER=$(echo $PR_URL | grep -oE '[0-9]+$')
166+
# Push directly to staging
167+
git push origin staging
235168
236-
# Enable auto-merge
237-
echo "Enabling auto-merge for PR #$PR_NUMBER..."
238-
gh pr merge $PR_NUMBER --auto --merge
169+
echo "✅ Successfully synced main to staging"
239170
env:
240171
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
241172

0 commit comments

Comments
 (0)