Skip to content

Commit d57cf8e

Browse files
authored
Merge pull request #2140 from github/henrymercer/rebuild-resolve-conflicts
Teach rebuild Action how to resolve conflicts in lib
2 parents c6cf6fd + 729def5 commit d57cf8e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/rebuild.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ jobs:
2424
gh pr edit --repo github/codeql-action "$PR_NUMBER" \
2525
--remove-label "Rebuild"
2626
27+
- name: Merge in changes from base branch
28+
env:
29+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
30+
run: |
31+
git fetch origin "$BASE_BRANCH"
32+
33+
# Allow merge conflicts in `lib`, since rebuilding should resolve them.
34+
git merge "origin/$BASE_BRANCH" || echo "Merge conflicts detected"
35+
36+
# Check for merge conflicts outside of `lib`. Disable git diff's trailing whitespace check
37+
# since `node_modules/@types/semver/README.md` fails it.
38+
if git -c core.whitespace=-trailing-space diff --check | grep --invert-match '^lib/'; then
39+
echo "Merge conflicts detected outside of lib/ directory. Please resolve them manually."
40+
git -c core.whitespace=-trailing-space diff --check | grep --invert-match '^lib/' || true
41+
exit 1
42+
fi
43+
2744
- name: Compile TypeScript
2845
run: |
2946
npm install

0 commit comments

Comments
 (0)