Error observed
The SonarCloud scan is not functioning as expected on pull requests. It fails to access the main branch, and the coverage of new lines of code is not determined. The pipeline completes successfully, but results do not seem to reflect the repository state accurately.
ALM used
GitHub
CI system used
GitHub Actions
Pipeline
Before this pipeline, tests and coverage report is generated.
name: Sonar
on:
workflow_call:
secrets:
SONAR_TOKEN:
required: true
jobs:
Sonar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.0
with:
fetch-depth: 0
- name: Download Test Artifact(s)
uses: actions/download-artifact@v4
with:
name: test-artifact
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Languages of the repository
Flutter/Dart
SonarCloud properties
# Configuration file for SonarCloud
sonar.projectKey=xxxxxxxx
sonar.organization=xxxxxxxx
sonar.projectName=xxxxxxxxx
sonar.projectVersion=1.0
sonar.language=dart
sonar.tests=test/
sonar.dart.lcov.reportPaths=coverage/lcov.info
sonar.sourceEncoding=UTF-8
Steps to reproduce
- Implement the provided GitHub Actions pipeline for SonarCloud.
- Configure the project with the sonar-project.properties file.
- Trigger a pull request.
Potential workaround
No known workaround at this point.