Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check

GitHub Action

dotnet-sonarscanner

v1.2

dotnet-sonarscanner

check

dotnet-sonarscanner

Run analysis for dotnet core via dotnet-sonarscanner

Installation

Copy and paste the following snippet into your .yml file.

              

- name: dotnet-sonarscanner

uses: Secbyte/dotnet-sonarscanner@v1.2

Learn more about this action in Secbyte/dotnet-sonarscanner

Choose a version

dotnet-sonarscanner

dotnet-sonarscanner GitHub Action.

Currently does not support username/password authentication and presumes you are using tokens. Open to changing this, if required.

Usage example

- name: Sonarscanner for dotnet
  uses: Secbyte/dotnet-sonarscanner@v1.2
  with:
    buildCommand: dotnet build .
    testCommand: dotnet test .
    projectKey: a-project-key
    projectName: a-project-name
    sonarOrganisation: an-org
    verbose: "true"
    openCoverPaths: "tests/coverage.opencover.xml"
    coverageExclusions: "**test*.cs"
  env:
    SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Inputs

buildCommand:
  description: "Command to invoke build"
  required: true
testCommand:
  description: "Command to invoke tests"
  required: false
projectKey:
  description: "Specifies the key of the analyzed project in SonarQube"
  required: true
projectName:
  description: "Specifies the name of the analyzed project in SonarQube"
  required: true
sonarHostname:
  description: "The server URL"
  default: "https://sonarcloud.io"
  required: false
sonarOrganisation:
  description: "Organisation"
  required: true
verbose:
  default: "false"
  description: "Enable verbose logging"
  required: false
openCoverPaths:
  description: "Path(s) to coverage file(s)"
  required: false
coverageExclusions:
  description: "Glob(s) for files to exclude from coverage"
  required: false

Environment variables

  • SONAR_TOKEN - Token from SonarCloud with ExecuteAnalysis permissions
  • GITHUB_TOKEN - GitHub Token