Skip to content

Commit 56b0d5f

Browse files
henrymercerCopilot
andcommitted
Fix the rebuild workflow failing when merging the base branch conflicts
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 27c60c5 commit 56b0d5f

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

‎.github/workflows/rebuild.yml‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,12 @@ jobs:
5454
run: |
5555
git fetch origin "$BASE_BRANCH"
5656
57-
# Allow merge conflicts in `lib`, since rebuilding should resolve them.
58-
git merge "origin/$BASE_BRANCH"
59-
MERGE_RESULT=$?
60-
61-
if [ "$MERGE_RESULT" -eq 0 ]; then
57+
# Allow merge conflicts in `lib`, since rebuilding should resolve them. Conflicts leave the
58+
# merge in progress, so check for `MERGE_HEAD` to tell them apart from failures that don't.
59+
if git merge "origin/$BASE_BRANCH"; then
6260
echo "Merge succeeded cleanly."
63-
elif [ "$MERGE_RESULT" -eq 1 ]; then
64-
echo "Merge conflicts detected (exit code $MERGE_RESULT), continuing."
65-
else
66-
echo "git merge failed with unexpected exit code $MERGE_RESULT."
67-
exit 1
68-
fi
69-
70-
if [ "$MERGE_RESULT" -ne 0 ]; then
61+
elif git rev-parse --verify MERGE_HEAD >/dev/null 2>&1; then
62+
echo "Merge conflicts detected, continuing."
7163
echo "merge-in-progress=true" >> $GITHUB_OUTPUT
7264
7365
# Check for merge conflicts outside of `lib`.
@@ -80,6 +72,9 @@ jobs:
8072
8173
echo "No merge conflicts found outside the lib directory. We should be able to resolve all of" \
8274
"these by rebuilding the Action."
75+
else
76+
echo "git merge failed for a reason other than merge conflicts."
77+
exit 1
8378
fi
8479
8580
- name: Compile TypeScript

0 commit comments

Comments
 (0)