From 2f739fcd04dfc437bd6ebafae18ff748981ac7fc Mon Sep 17 00:00:00 2001 From: Aditya Sharad Date: Thu, 28 Jul 2022 17:02:52 -0700 Subject: [PATCH] CI: Combine verify-pr-checks and check-for-conflicts jobs Reduce the number of concurrent jobs by 1. Run these checks in succession instead, as the `check-file-contents` job in the PR checks workflow. --- .github/workflows/check-for-conflicts.yml | 31 ----------------------- .github/workflows/pr-checks.yml | 28 +++++++++++++++++--- 2 files changed, 25 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/check-for-conflicts.yml diff --git a/.github/workflows/check-for-conflicts.yml b/.github/workflows/check-for-conflicts.yml deleted file mode 100644 index fe96d9ac3b..0000000000 --- a/.github/workflows/check-for-conflicts.yml +++ /dev/null @@ -1,31 +0,0 @@ -# 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, releases/v1, releases/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: | - # Use `|| true` since grep returns exit code 1 if there are no matches, and we don't want - # this to fail the workflow. - FILES_WITH_CONFLICTS=$(grep --extended-regexp --ignore-case --line-number --recursive \ - '^(<<<<<<<|>>>>>>>)' . || true) - 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 diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index fb5b615b1c..a97ef1d405 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -62,21 +62,43 @@ jobs: - name: Check node modules up to date run: .github/workflows/script/check-node-modules.sh - verify-pr-checks: - name: Verify PR checks up to date + check-file-contents: + name: Check file contents runs-on: ubuntu-latest timeout-minutes: 45 steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 + + # 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 merge conflicts + run: | + # Use `|| true` since grep returns exit code 1 if there are no matches, and we don't want + # this to fail the workflow. + FILES_WITH_CONFLICTS=$(grep --extended-regexp --ignore-case --line-number --recursive \ + '^(<<<<<<<|>>>>>>>)' . || true) + 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 + - name: Set up Python uses: actions/setup-python@v3 with: python-version: 3.8 + - name: Install dependencies run: | python -m pip install --upgrade pip pip install ruamel.yaml + + # Ensure the generated PR check workflows are up to date. - name: Verify PR checks up to date run: .github/workflows/script/verify-pr-checks.sh