Skip to content

Commit 677b8ed

Browse files
authored
fix: gracefully handle merge conflicts in main to feature branches action (#77)
1 parent 0179596 commit 677b8ed

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/actions/merge-main/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,25 @@ runs:
8686
return
8787
fi
8888
89+
failed="false"
90+
8991
for branch in "${branches[@]}"; do
9092
echo "...switching to branch: $branch"
9193
git switch "$branch"
9294
echo "...merging main"
93-
git merge -m "misc: merge from main" origin/main
94-
if [ $? -eq 0 ]; then
95+
if git merge -m "misc: merge from main" origin/main; then
9596
echo "...pushing to origin"
9697
git push origin "$branch"
9798
else
9899
echo "...merge failed"
100+
failed="true"
99101
git merge --abort
100102
fi
101103
done
104+
105+
if [ "$failed" == "true" ]; then
106+
exit 1
107+
fi
102108
}
103109
104110
merge_main

0 commit comments

Comments
 (0)