Skip to content

Commit d779fce

Browse files
authored
build: fix merge failed when conflict. (#855)
* build: fix merge failed when conflict. * revert to previous name.
1 parent 17cf52f commit d779fce

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/merge-from-milestone.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,33 @@ jobs:
113113
114114
echo "Cherry-picking commit: $merge_commit"
115115
if ! git cherry-pick "$merge_commit" --strategy=recursive -X theirs; then
116-
echo "Cherry-pick encountered conflicts, attempting to continue..."
117-
git cherry-pick --continue || { echo "Cherry-pick failed"; exit 1; }
116+
echo "Conflict detected for $merge_commit. Resolving with incoming changes."
117+
conflict_files=$(git diff --name-only --diff-filter=U)
118+
echo "Conflicting files:"
119+
echo "$conflict_files"
120+
121+
for file in $conflict_files; do
122+
if [ -f "$file" ]; then
123+
echo "Resolving conflict for $file"
124+
git add "$file"
125+
else
126+
echo "File $file has been deleted. Skipping."
127+
git rm "$file"
128+
fi
129+
done
130+
131+
echo "Conflicts resolved. Continuing cherry-pick."
132+
git cherry-pick --continue || { echo "Cherry-pick failed, but continuing to create PR."; }
133+
else
134+
echo "Cherry-pick successful for commit $merge_commit."
118135
fi
119136
120137
git remote set-url origin "https://${BOT_TOKEN}@github.com/${{ github.repository }}.git"
121138
122139
echo "Pushing branch: $cherry_pick_branch"
123-
git push origin $cherry_pick_branch --force || { echo "Push failed"; exit 1; }
140+
if ! git push origin $cherry_pick_branch --force; then
141+
echo "Push failed, but continuing to create PR..."
142+
fi
124143
125144
new_pr_title="$pr_title [Created by @$pr_creator from #$pr_number]"
126145
new_pr_body="$pr_body

0 commit comments

Comments
 (0)