diff --git a/README.md b/README.md index a516f61..a70acc1 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ _Currently does not support username/password authentication and presumes you ar ```yaml - name: Sonarscanner for dotnet - uses: Secbyte/dotnet-sonarscanner@v1.0 + uses: Secbyte/dotnet-sonarscanner@v1.1 with: buildCommand: dotnet build . testCommand: dotnet test . @@ -17,6 +17,7 @@ _Currently does not support username/password authentication and presumes you ar sonarOrganisation: an-org verbose: "true" openCoverPaths: "tests/coverage.opencover.xml" + coverageExclusions: "**test*.cs" env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -51,6 +52,9 @@ verbose: openCoverPaths: description: "Path(s) to coverage file(s)" required: false +coverageExclusions: + description: "Glob(s) for files to exclude from coverage" + required: false ``` ## Environment variables diff --git a/action.yml b/action.yml index 65ff9cd..72d50db 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,9 @@ inputs: openCoverPaths: description: "Path(s) to coverage file(s)" required: false + coverageExclusions: + description: "Glob(s) for files to exclude from coverage" + required: false runs: using: "docker" @@ -42,6 +45,7 @@ runs: - ${{ inputs.sonarOrganisation }} - ${{ inputs.verbose }} - ${{ inputs.openCoverPaths }} + - ${{ inputs.coverageExclusions }} branding: icon: 'check' diff --git a/entrypoint.sh b/entrypoint.sh index 64d61cd..a6f96b7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,6 +8,7 @@ # sonarOrganisation = $6 # verbose = $7 # openCoverPaths = $8 +# coverageExclusions = $9 set -eu @@ -44,6 +45,11 @@ then begin_cmd="$begin_cmd /d:sonar.cs.opencover.reportsPaths=\"$8\"" fi +if [ -n "$9" ] +then + begin_cmd="$begin_cmd /d:sonar.coverage.exclusions=\"$9\"" +fi + if [ -n "${SONAR_TOKEN}" ] then begin_cmd="$begin_cmd /d:sonar.login=\"${SONAR_TOKEN}\""