I am trying to integrate sonarcloud with github. Using a .net platform. I am doing following steps:
Setup Job - Passing
Checkout Code - Passing
Change Directory - Passing
set up .net core sdk - Passing
install sonarcloud scanner for Ms build - Passing
restore dependencies- Passing
build - Passing
sonar cloud analysis.FAILING
Sonar Cloud Analysis is failing with the following error:
“Unhandled exception. System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 ().”
I have tried the following: confirm project key is correct, confirm sonar_token is in settings, also deleted regenerated sonar_token and readded it, created a github token under developer setting and added it to repository secrets but still same issue
Here is my Yaml file:
name: SonarCloud Scan
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud_scan:
name: SonarCloud Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
# Change directory to the project directory
- name: Change Directory
run: cd AlcoholDeliverAPI/AlcoholDeliverAPI
- name: Set up .NET Core SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0'
- name: Install SonarCloud Scanner for MSBuild
run: dotnet tool install --global dotnet-sonarscanner
- name: Restore dependencies
run: dotnet restore <csproj path>
- name: Build
run: dotnet build <csproj path>
- name: SonarCloud Analysis
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner begin /k:"<projectkey>" /o:"<organization>" /d:sonar.host.url="https://sonarcloud.io" && dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"