Template for a good new topic, formatted with Markdown:
- ALM used (GitHub)
- CI system used (GH Actions)
- Languages of the repository (C#)
- Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 34.191s
INFO: Final Memory: 20M/70M
ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key '21'
INFO: ------------------------------------------------------------------------
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=DYMSA-ING_Sistema-Visitantes&pullrequestKey=21 : {"errors":[{"msg":"The pullrequest could not be found"}]}
ERROR:
The SonarScanner did not complete successfully
13:04:37.779 Post-processing failed. Exit code: 1
Error: Process completed with exit code 1.
- Steps to reproduce:
- Purchase SonarCloud
- Link to GitHub repository
- Do the quick setup steps
- PR to the branch
- Failed
I have checked that the PR exists. Tried multiple times with different PRs and fails anyway. I have only changed the triggers and the “insert command here” section. What am I doing wrong? Help pls.
(There are 2 .NET projects, one called Web and one called API, both commands work just fine in console).
Here is my sonarcloud.yml file:
on:
pull_request:
branches:
- master
- prod
jobs:
build:
name: Build and analyze
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu' # Alternative distribution options are available.
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"DYMSA-ING_Sistema-Visitantes" /o:"dymsa-ing" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build api
dotnet build web
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"```