Skip to content

Commit 489571f

Browse files
authored
fix: solve stop when merge failed (#3106)
1 parent ad8829c commit 489571f

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

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

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +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 resolve..."
117-
git status --porcelain | grep '^UU ' | cut -c 4- | while read -r file; do
118-
echo "Resolving conflict in $file"
119-
git add "$file"
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
120129
done
121-
git status --porcelain | grep '^AA ' | cut -c 4- | while read -r file; do
122-
echo "Adding new file $file"
123-
git add "$file"
124-
done
125-
git status --porcelain | grep '^DD ' | cut -c 4- | while read -r file; do
126-
echo "Removing deleted file $file"
127-
git rm "$file"
128-
done
129-
git cherry-pick --continue || { echo "Cherry-pick failed"; continue; }
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."
130135
fi
131136
132137
git remote set-url origin "https://${BOT_TOKEN}@github.com/${{ github.repository }}.git"
133138
134139
echo "Pushing branch: $cherry_pick_branch"
135-
git push origin $cherry_pick_branch --force || { echo "Push failed"; continue; }
140+
if ! git push origin $cherry_pick_branch --force; then
141+
echo "Push failed, but continuing to create PR..."
142+
fi
136143
137144
new_pr_title="$pr_title [Created by @$pr_creator from #$pr_number]"
138145
new_pr_body="$pr_body

0 commit comments

Comments
 (0)