File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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`.
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
You can’t perform that action at this time.
0 commit comments