From 2f654ce851cd688aae6667fb8f7f43732643860e Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 16 May 2024 13:21:27 +0000 Subject: [PATCH] ci-consistency as external check --- .github/workflows/ci.yml | 33 ++++++++++++++++++++++++++++++ .github/workflows/setup-runner.yml | 24 ---------------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aeab526ec8..32441242a88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,39 @@ jobs: username: ${{ github.event.pull_request.user.login || github.actor }} runner_type: builder-x86 secrets: inherit + # job just to alert that you *might* hit missing CI files, but if not you can continue + + ci-consistency: + runs-on: ubuntu-latest + # Only check PRs for consistency (not master) + if: ${{ github.event.pull_request.head.sha != '' }} + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Checkout Merge Pipeline Files + uses: actions/checkout@v4 + with: + path: merge-commit-pipeline-files + sparse-checkout: | + .github/workflows/ci.yml + .github/workflows/setup-runner.yml + + - name: Ensure CI Consistency + if: ${{ github.event.pull_request.head.sha != '' }} + run: | + # Compare the checked-out CI configuration files with the reference files + if ! git diff --no-index .github/workflows/ci.yml merge-commit-pipeline-files/.github/workflows/ci.yml; then + echo "Error: ci.yml changes in master (or PR base). *Usually* you can continue just fine. If you hit trouble with missing files, please merge these changes. This is to alert about potential surprises from Github Action's merge behavior." + exit 1 + fi + if ! git diff --no-index .github/workflows/setup-runner.yml merge-commit-pipeline-files/.github/workflows/setup-runner.yml; then + echo "Error: setup-runner.yml changes in master (or PR base). *Usually* you can continue just fine. If you hit trouble with missing files, please merge these changes. This is to alert about potential surprises from Github Action's merge behavior." + exit 1 + fi + build: needs: setup runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 diff --git a/.github/workflows/setup-runner.yml b/.github/workflows/setup-runner.yml index de6a0d6e893..3434e3432b3 100644 --- a/.github/workflows/setup-runner.yml +++ b/.github/workflows/setup-runner.yml @@ -53,30 +53,6 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Checkout Merge Pipeline Files - uses: actions/checkout@v4 - # Only check PRs for consistency (not master) - if: ${{ github.event.pull_request.head.sha != '' }} - with: - path: merge-commit-pipeline-files - sparse-checkout: | - .github/workflows/ci.yml - .github/workflows/setup-runner.yml - - - name: Ensure CI Consistency - # Only check PRs for consistency (not master) - if: ${{ github.event.pull_request.head.sha != '' }} - run: | - # Compare the checked-out CI configuration files with the reference files - if ! git diff --no-index .github/workflows/ci.yml merge-commit-pipeline-files/.github/workflows/ci.yml; then - echo "Error: ci.yml changes in master (or PR base). Please merge these changes. This is to prevent surprises from Github Action's merge behavior." - exit 1 - fi - if ! git diff --no-index .github/workflows/setup-runner.yml merge-commit-pipeline-files/.github/workflows/setup-runner.yml; then - echo "Error: setup-runner.yml changes in master (or PR base). Please merge these changes. This is to prevent surprises from Github Action's merge behavior." - exit 1 - fi - - name: Start EC2 runner uses: ./.github/ensure-builder with: