Skip to content

Commit

Permalink
chore(ci): consistency as external check (#6460)
Browse files Browse the repository at this point in the history
This will no longer fail build merges
  • Loading branch information
ludamad authored May 16, 2024
1 parent 74d6519 commit 6793a75
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/setup-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6793a75

Please sign in to comment.