diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce3654e5868..3ec01d7a022 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,11 +6,6 @@ name: Build on: push: branches: ["main"] - paths: - - "autogen/**" - - "test/**" - - ".github/workflows/build.yml" - - "setup.py" pull_request: branches: ["main"] merge_group: @@ -21,7 +16,39 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} permissions: {} jobs: + paths-filter: + runs-on: ubuntu-latest + outputs: + hasChanges: ${{ steps.filter.outputs.autogen == 'true' || steps.filter.outputs.test == 'true' || steps.filter.outputs.workflows == 'true' || steps.filter.outputs.setup == 'true' }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + autogen: + - "autogen/**" + test: + - "test/**" + workflows: + - ".github/workflows/build.yml" + setup: + - "setup.py" + - name: autogen has changes + run: echo "autogen has changes" + if: steps.filter.outputs.autogen == 'true' + - name: test has changes + run: echo "test has changes" + if: steps.filter.outputs.test == 'true' + - name: workflows has changes + run: echo "workflows has changes" + if: steps.filter.outputs.workflows == 'true' + - name: setup has changes + run: echo "setup has changes" + if: steps.filter.outputs.setup == 'true' build: + needs: paths-filter + if: needs.paths-filter.outputs.hasChanges == 'true' runs-on: ${{ matrix.os }} env: AUTOGEN_USE_DOCKER: ${{ matrix.os != 'ubuntu-latest' && 'False' }} diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 332e656c9f1..046a5b6d79b 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -7,8 +7,6 @@ on: workflow_dispatch: pull_request: branches: [ "main" ] - paths: - - 'dotnet/**' push: branches: [ "main" ] @@ -21,9 +19,26 @@ permissions: packages: write jobs: + paths-filter: + runs-on: ubuntu-latest + outputs: + hasChanges: ${{ steps.filter.outputs.dotnet == 'true'}} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + dotnet: + - "dotnet/**" + - name: dotnet has changes + run: echo "dotnet has changes" + if: steps.filter.outputs.dotnet == 'true' build: name: Dotnet Build runs-on: ubuntu-latest + needs: paths-filter + if: needs.paths-filter.outputs.hasChanges == 'true' defaults: run: working-directory: dotnet