From 4fd6d94c78a8634cf62282e455d81e957b1508ec Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Thu, 14 Apr 2022 19:38:04 +0100 Subject: [PATCH] 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. --- .github/workflows/check-for-conflicts.yml | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/check-for-conflicts.yml diff --git a/.github/workflows/check-for-conflicts.yml b/.github/workflows/check-for-conflicts.yml new file mode 100644 index 0000000000..d04e70936e --- /dev/null +++ b/.github/workflows/check-for-conflicts.yml @@ -0,0 +1,29 @@ +# Checks for any conflict markers created by git. This check is primarily intended to validate that +# any merge conflicts in the v2 -> v1 backport PR are fixed before the PR is merged. +name: Check for conflicts + +on: + pull_request: + branches: [main, v1, v2] + # Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened + # by other workflows. + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + check-for-conflicts: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Check for conflicts + run: | + FILES_WITH_CONFLICTS=$(grep --extended-regexp --ignore-case --line-number --recursive \ + '^(<<<<<<<|>>>>>>>)' .) + if [[ "${FILES_WITH_CONFLICTS}" ]]; then + echo "Fail: Found merge conflict markers in the following files:" + echo "" + echo "${FILES_WITH_CONFLICTS}" + exit 1 + else + echo "Success: Found no merge conflict markers." + fi