chore: Remove need for force merges (#13021)

This commit is contained in:
Keith Williams 2024-01-03 14:51:24 -05:00 committed by GitHub
parent c4b296d580
commit 71e57bafde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,9 +4,6 @@ on:
pull_request_target: pull_request_target:
branches: branches:
- main - main
paths-ignore:
- "**.md"
- ".github/CODEOWNERS"
merge_group: merge_group:
workflow_dispatch: workflow_dispatch:
@ -15,36 +12,62 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
changes:
name: Detect changes
runs-on: buildjet-4vcpu-ubuntu-2204
permissions:
pull-requests: read
outputs:
has-files-requiring-all-checks: ${{ steps.filter.outputs.has-files-requiring-all-checks }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
has-files-requiring-all-checks:
- "!(**.md|.github/CODEOWNERS)"
type-check: type-check:
name: Type check name: Type check
needs: [changes]
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/check-types.yml uses: ./.github/workflows/check-types.yml
secrets: inherit secrets: inherit
test: test:
name: Unit tests name: Unit tests
needs: [changes]
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/unit-tests.yml uses: ./.github/workflows/unit-tests.yml
secrets: inherit secrets: inherit
lint: lint:
name: Linters name: Linters
needs: [changes]
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/lint.yml uses: ./.github/workflows/lint.yml
secrets: inherit secrets: inherit
build: build:
name: Production build name: Production build
needs: [changes]
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/production-build.yml uses: ./.github/workflows/production-build.yml
secrets: inherit secrets: inherit
analyze: analyze:
needs: build name: Analyze Build
needs: [changes, build]
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/nextjs-bundle-analysis.yml uses: ./.github/workflows/nextjs-bundle-analysis.yml
secrets: inherit secrets: inherit
required: required:
needs: [lint, type-check, test, build] needs: [changes, lint, type-check, test, build]
if: always() if: always()
runs-on: buildjet-4vcpu-ubuntu-2204 runs-on: buildjet-4vcpu-ubuntu-2204
steps: steps:
- name: fail if conditional jobs failed - name: fail if conditional jobs failed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled') if: needs.changes.outputs.has-files-requiring-all-checks == 'true' && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled'))
run: exit 1 run: exit 1