@@ -74,28 +74,64 @@ jobs:
7474
7575 echo "✅ Created sync PR"
7676 else
77- echo "⚠️ Merge conflict — creating PR with conflict markers for manual resolution."
77+ echo "Merge conflict — attempting auto-resolution of release artifacts..."
78+
79+ # Auto-resolve expected conflicts: package.json version and CHANGELOG.md.
80+ # For these files, keep main's version (semantic-release manages them per-branch).
81+ for f in packages/superdoc/package.json packages/superdoc/CHANGELOG.md; do
82+ if git diff --name-only --diff-filter=U | grep -qF "$f"; then
83+ echo " Auto-resolving $f (keeping main's version)"
84+ git checkout --ours "$f"
85+ git add "$f"
86+ fi
87+ done
88+
89+ # Check if all conflicts are resolved
90+ if [ -z "$(git diff --name-only --diff-filter=U)" ]; then
91+ git commit --no-edit
92+ git push origin "$SYNC_BRANCH"
93+
94+ gh pr create \
95+ --base main \
96+ --head "$SYNC_BRANCH" \
97+ --title "🔄 Sync stable → main" \
98+ --body "$(cat <<'EOF'
99+ ## Summary
100+ Merges latest stable patches into main to keep branches in sync.
78101
79- # Abort the failed merge and try again with conflict markers
80- git merge --abort
81- git merge origin/stable --no-edit --no-commit || true
82- git add -A
83- git commit -m "chore: merge stable into main (conflicts need resolution)"
84- git push origin "$SYNC_BRANCH"
102+ Release artifact conflicts (package.json version, CHANGELOG.md) were auto-resolved.
85103
86- gh pr create \
87- --base main \
88- --head "$SYNC_BRANCH" \
89- --title "🔄 Sync stable → main (conflicts)" \
90- --body "$(cat <<'EOF'
104+ ---
105+ _Auto-created by sync-patches workflow._
106+ EOF
107+ )" \
108+ --label "patch-sync"
109+
110+ echo "✅ Created sync PR (release conflicts auto-resolved)"
111+ else
112+ echo "⚠️ Unresolved conflicts remain — creating PR for manual resolution."
113+
114+ # Commit with conflict markers so the PR is reviewable
115+ git add -A
116+ git commit -m "chore: merge stable into main (conflicts need resolution)"
117+ git push origin "$SYNC_BRANCH"
118+
119+ gh pr create \
120+ --base main \
121+ --head "$SYNC_BRANCH" \
122+ --title "🔄 Sync stable → main (conflicts)" \
123+ --body "$(cat <<'EOF'
91124 ## Summary
92125 Merges latest stable patches into main. **Has merge conflicts that need manual resolution.**
93126
127+ Release artifact conflicts were auto-resolved, but other conflicts remain.
128+
94129 ---
95130 _Auto-created by sync-patches workflow._
96131 EOF
97- )" \
98- --label "patch-sync"
132+ )" \
133+ --label "patch-sync"
99134
100- echo "⚠️ Created sync PR with conflicts"
135+ echo "⚠️ Created sync PR with conflicts"
136+ fi
101137 fi
0 commit comments