Skip to content

Commit a7c7e5d

Browse files
committed
refactor: simplify version sync workflow
- Remove unnecessary sync branch creation - Create PRs directly from main to develop/staging - Simplify infinite loop prevention logic - More efficient and cleaner workflow
1 parent 2c2708e commit a7c7e5d

File tree

2 files changed

+10
-39
lines changed

2 files changed

+10
-39
lines changed

.github/workflows/integrate-develop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
create-or-update-pr:
1414
name: Create or Update PR to Staging
1515
runs-on: ubuntu-latest
16-
# Skip if this is a sync commit from main
17-
if: ${{ !contains(github.event.head_commit.message, 'sync version updates from main') && !contains(github.event.head_commit.message, 'Sync: main → develop') && !startsWith(github.event.head_commit.message, 'Merge pull request') && github.event.head_commit.author.name != 'github-actions[bot]' || !contains(github.event.head_commit.message, 'sync/main-to-develop') }}
16+
# Skip if this is a merge from main branch sync PR
17+
if: ${{ !contains(github.event.head_commit.message, 'Sync: main → develop') }}
1818
permissions:
1919
contents: write
2020
pull-requests: write

.github/workflows/update-version.yml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,9 @@ jobs:
136136
137137
- name: Sync to develop
138138
run: |
139-
echo "🔄 Syncing changes to develop branch..."
139+
echo "🔄 Creating PR to sync changes to develop branch..."
140140
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
141+
# Create PR directly from main to develop
155142
VERSION="${{ steps.version-update.outputs.version }}"
156143
157144
{
@@ -163,15 +150,15 @@ jobs:
163150
echo "Version: **v$VERSION**"
164151
echo ""
165152
echo "### ⚡ Auto-merge"
166-
echo "This PR should be merged automatically to keep branches in sync."
153+
echo "This PR will be merged automatically to keep branches in sync."
167154
echo ""
168155
echo "---"
169156
echo "*This PR was automatically created by the version update workflow*"
170157
} > pr-body.md
171158
172159
PR_URL=$(gh pr create \
173160
--base develop \
174-
--head $SYNC_BRANCH \
161+
--head main \
175162
--title "🔄 Sync: main → develop (v$VERSION)" \
176163
--body-file pr-body.md \
177164
--label "auto-updated")
@@ -187,25 +174,9 @@ jobs:
187174

188175
- name: Sync to staging
189176
run: |
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
177+
echo "🔄 Creating PR to sync changes to staging branch..."
207178
208-
# Create PR
179+
# Create PR directly from main to staging
209180
VERSION="${{ steps.version-update.outputs.version }}"
210181
211182
{
@@ -217,15 +188,15 @@ jobs:
217188
echo "Version: **v$VERSION**"
218189
echo ""
219190
echo "### ⚡ Auto-merge"
220-
echo "This PR should be merged automatically to keep branches in sync."
191+
echo "This PR will be merged automatically to keep branches in sync."
221192
echo ""
222193
echo "---"
223194
echo "*This PR was automatically created by the version update workflow*"
224195
} > pr-body-staging.md
225196
226197
PR_URL=$(gh pr create \
227198
--base staging \
228-
--head $SYNC_BRANCH \
199+
--head main \
229200
--title "🔄 Sync: main → staging (v$VERSION)" \
230201
--body-file pr-body-staging.md \
231202
--label "auto-updated")

0 commit comments

Comments
 (0)