Skip to content

Commit 19d025e

Browse files
authored
Merge pull request #1161 from github/adityasharad/actions/combined-check-file-contents
CI: Combine verify-pr-checks and check-for-conflicts jobs
2 parents 495c200 + 2f739fc commit 19d025e

File tree

2 files changed

+25
-34
lines changed

2 files changed

+25
-34
lines changed

.github/workflows/check-for-conflicts.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/pr-checks.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,43 @@ jobs:
6262
- name: Check node modules up to date
6363
run: .github/workflows/script/check-node-modules.sh
6464

65-
verify-pr-checks:
66-
name: Verify PR checks up to date
65+
check-file-contents:
66+
name: Check file contents
6767
runs-on: ubuntu-latest
6868
timeout-minutes: 45
6969

7070
steps:
71-
- uses: actions/checkout@v3
71+
- name: Checkout
72+
uses: actions/checkout@v3
73+
74+
# Checks for any conflict markers created by git. This check is primarily intended to validate that
75+
# any merge conflicts in the v2 -> v1 backport PR are fixed before the PR is merged.
76+
- name: Check for merge conflicts
77+
run: |
78+
# Use `|| true` since grep returns exit code 1 if there are no matches, and we don't want
79+
# this to fail the workflow.
80+
FILES_WITH_CONFLICTS=$(grep --extended-regexp --ignore-case --line-number --recursive \
81+
'^(<<<<<<<|>>>>>>>)' . || true)
82+
if [[ "${FILES_WITH_CONFLICTS}" ]]; then
83+
echo "Fail: Found merge conflict markers in the following files:"
84+
echo ""
85+
echo "${FILES_WITH_CONFLICTS}"
86+
exit 1
87+
else
88+
echo "Success: Found no merge conflict markers."
89+
fi
90+
7291
- name: Set up Python
7392
uses: actions/setup-python@v3
7493
with:
7594
python-version: 3.8
95+
7696
- name: Install dependencies
7797
run: |
7898
python -m pip install --upgrade pip
7999
pip install ruamel.yaml
100+
101+
# Ensure the generated PR check workflows are up to date.
80102
- name: Verify PR checks up to date
81103
run: .github/workflows/script/verify-pr-checks.sh
82104

0 commit comments

Comments
 (0)