From 87049aff3088b63d28c003701a453cd1fd4a30dd Mon Sep 17 00:00:00 2001 From: Sebastien DEGODEZ Date: Sat, 21 Dec 2024 00:10:15 +0100 Subject: [PATCH] ci: updated steps.dotnet-build-test.yml Skip SonarCloud Scan if the pull request is from a forked repository Signed-off-by: SebastienDegodez --- .github/workflows/steps.dotnet-build-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/steps.dotnet-build-test.yml b/.github/workflows/steps.dotnet-build-test.yml index f3b4191..76a3dea 100644 --- a/.github/workflows/steps.dotnet-build-test.yml +++ b/.github/workflows/steps.dotnet-build-test.yml @@ -61,7 +61,8 @@ jobs: run: dotnet restore - name: 🔍 Start SonarQube Analysis - if: ${{ inputs.use-sonarcloud == true && github.repository == 'microcks/microcks-testcontainers-dotnet' }} + # Skip SonarCloud Scan if the pull request is from a forked repository + if: ${{ inputs.use-sonarcloud == true && ((github.repository == 'microcks/microcks-testcontainers-dotnet' && github.event_name != 'pull_request') ||(github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request')) }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -99,7 +100,8 @@ jobs: shell: pwsh - name: Stop SonarQube Analysis - if: ${{ inputs.use-sonarcloud == true && (success() || steps.test-with-coverage.conclusion == 'failure') && github.repository == 'microcks/microcks-testcontainers-dotnet' }} + # Skip SonarCloud Scan if the pull request is from a forked repository + if: ${{ inputs.use-sonarcloud == true && (success() || steps.test-with-coverage.conclusion == 'failure') && ((github.repository == 'microcks/microcks-testcontainers-dotnet' && github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request')) }} id: sonar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}