11name : Auto-Sync Test Branch
22
33on :
4- # Trigger after successful release or publication workflows
4+ # Trigger after successful merge to main, after semver workflows complete
55 workflow_run :
6- workflows : ["Automated Release", "Automated Publication "]
6+ workflows : ["Release Workflow "]
77 types :
88 - completed
99 branches : [main]
10-
11- # Also trigger on direct pushes to main (for hotfixes or manual commits)
12- push :
13- branches : [main]
14-
10+
1511 # Manual trigger for testing and maintenance
1612 workflow_dispatch :
1713 inputs :
@@ -125,46 +121,22 @@ jobs:
125121 if : steps.validation.outputs.VALIDATION_ISSUES != 'true' || github.event.inputs.force_sync == 'true'
126122 run : |
127123 echo "Proceeding with test branch synchronization..."
128-
129- # Fetch latest changes from both branches
130- git fetch origin main:main --force
131- git fetch origin test:test --force
132-
124+
133125 # Switch to test branch
134126 git checkout test
135-
136- # Show current status
137- echo "Current test branch commit:"
138- git log --oneline -1
139- echo "Latest main branch commit:"
140- git log --oneline main -1
141-
142- # Check if test is already up to date with main
143- if git merge-base --is-ancestor main test; then
144- echo "Test branch is already up to date with main"
145- echo "ALREADY_UP_TO_DATE=true" >> $GITHUB_OUTPUT
146- exit 0
147- fi
148-
127+ git pull origin test
128+
149129 # Attempt merge with main
150- if git merge main --no-edit -m "chore: auto-sync test branch with main
151-
152- Automated synchronization of test branch with latest main branch changes.
153-
154- 🤖 Generated by Auto-Sync workflow run #${{ github.run_number }}"; then
130+ if git merge origin/main --no-edit; then
155131 echo "MERGE_SUCCESS=true" >> $GITHUB_OUTPUT
156132 echo "Merge completed successfully"
157-
158- # Show what was merged
159- echo "Changes merged from main:"
160- git log --oneline test^..test
161133 else
162134 echo "MERGE_CONFLICT=true" >> $GITHUB_OUTPUT
163135 echo "Merge conflicts detected"
164-
136+
165137 # Get conflict files for reporting
166138 git status --porcelain | grep "^UU" | cut -c4- > conflict_files.txt || echo "No conflict files detected"
167-
139+
168140 # Abort the merge
169141 git merge --abort
170142 fi
@@ -229,22 +201,12 @@ jobs:
229201 echo "## Auto-Sync Summary" >> $GITHUB_STEP_SUMMARY
230202 echo "- **Trigger**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
231203 echo "- **Main branch validation**: ${{ steps.validation.outputs.VALIDATION_ISSUES == 'true' && '❌ Failed' || '✅ Passed' }}" >> $GITHUB_STEP_SUMMARY
232-
233- # Determine sync status
234- if [ "${{ steps.sync.outputs.ALREADY_UP_TO_DATE }}" == "true" ]; then
235- echo "- **Sync status**: ✅ Already up to date" >> $GITHUB_STEP_SUMMARY
236- elif [ "${{ steps.sync.outputs.MERGE_SUCCESS }}" == "true" ]; then
237- echo "- **Sync status**: ✅ Successfully synchronized" >> $GITHUB_STEP_SUMMARY
238- elif [ "${{ steps.sync.outputs.MERGE_CONFLICT }}" == "true" ]; then
239- echo "- **Sync status**: ⚠️ Merge conflicts detected" >> $GITHUB_STEP_SUMMARY
240- else
241- echo "- **Sync status**: ⏭️ Skipped (validation issues)" >> $GITHUB_STEP_SUMMARY
242- fi
243-
204+ echo "- **Sync attempt**: ${{ steps.sync.outputs.MERGE_SUCCESS == 'true' && '✅ Success' || steps.sync.outputs.MERGE_CONFLICT == 'true' && '⚠️ Conflicts' || '⏭️ Skipped' }}" >> $GITHUB_STEP_SUMMARY
205+
244206 if [ "${{ steps.validation.outputs.ANY_TYPES_COUNT }}" -gt 0 ]; then
245207 echo "- **'any' types detected**: ${{ steps.validation.outputs.ANY_TYPES_COUNT }}" >> $GITHUB_STEP_SUMMARY
246208 fi
247-
209+
248210 if [ "${{ steps.sync.outputs.MERGE_CONFLICT }}" == "true" ]; then
249211 echo "- **Manual intervention required**: Merge conflicts need resolution" >> $GITHUB_STEP_SUMMARY
250212 fi
0 commit comments