From 2f66235a338c8ef06f063436a03b7cd487eeeaf5 Mon Sep 17 00:00:00 2001 From: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> Date: Thu, 2 Oct 2025 20:06:53 +0100 Subject: [PATCH] .NET: Update dotnet tests workflow to be merge queue friendly (#1133) * Checks were missing from setup - no change needed to config * Changing path filtering logic for dotnet tests * Update .github/workflows/dotnet-build-and-test.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/dotnet-build-and-test.yml | 36 ++++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dotnet-build-and-test.yml b/.github/workflows/dotnet-build-and-test.yml index 79d757e3a0..073177d483 100644 --- a/.github/workflows/dotnet-build-and-test.yml +++ b/.github/workflows/dotnet-build-and-test.yml @@ -8,17 +8,11 @@ name: dotnet-build-and-test on: workflow_dispatch: pull_request: - branches: ["main", "feature*"] - paths: - - dotnet/** - - '.github/workflows/dotnet-build-and-test.yml' + branches: ["main"] merge_group: branches: ["main"] push: - branches: ["main", "feature*"] - paths: - - dotnet/** - - '.github/workflows/dotnet-build-and-test.yml' + branches: ["main"] schedule: - cron: "0 0 * * *" # Run at midnight UTC daily @@ -34,7 +28,33 @@ permissions: id-token: "write" jobs: + paths-filter: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + dotnetChanges: ${{ steps.filter.outputs.dotnet}} + steps: + - uses: actions/checkout@v5 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + dotnet: + - 'dotnet/**' + # run only if 'dotnet' files were changed + - name: dotnet tests + if: steps.filter.outputs.dotnet == 'true' + run: echo "Dotnet file" + # run only if not 'dotnet' files were changed + - name: not dotnet tests + if: steps.filter.outputs.dotnet != 'true' + run: echo "NOT dotnet file" + dotnet-build-and-test: + needs: paths-filter + if: needs.paths-filter.outputs.dotnetChanges == 'true' strategy: fail-fast: false matrix: