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 }}