Skip to content

Commit 30b3365

Browse files
committed
Add a PR check to check for conflict markers
This check is primarily intended to validate that any merge conflicts in the v2 -> v1 backport PR are fixed before the PR is merged.
1 parent b3bf557 commit 30b3365

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Checks for any conflict markers created by git. This check is primarily intended to validate that
2+
# any merge conflicts in the v2 -> v1 backport PR are fixed before the PR is merged.
3+
name: Check for conflicts
4+
5+
on:
6+
pull_request:
7+
branches: [main, v1, v2]
8+
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
9+
# by other workflows.
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
# For testing
12+
push:
13+
14+
jobs:
15+
check-for-conflicts:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Check for conflicts
21+
run: |
22+
FILES_WITH_CONFLICTS=$(grep --extended-regexp --ignore-case --line-number --recursive \
23+
'^(<<<<<<<|>>>>>>>)' .)
24+
if [[ "${FILES_WITH_CONFLICTS}" ]]; then
25+
echo "Fail: Found merge conflict markers in the following files:"
26+
echo ""
27+
echo "${FILES_WITH_CONFLICTS}"
28+
exit 1
29+
else
30+
echo "Success: Found no merge conflict markers."
31+
fi

0 commit comments

Comments
 (0)