Hi all, I’m running into a problem where the PR code is showing empty
I’m uploading the results to sonarcloud using the github action
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # shallow clones disabled for sonar cloud
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies & Run make
run: |
poetry install --no-root
poetry run sh scripts/lint.sh
poetry run sh scripts/coverage.sh
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
My config is as follows:
sonar.projectKey=***
sonar.organization=***
When I run a scan like this I get the following warning:
The following error(s) occurred while trying to import coverage report:
Invalid directory path in 'source' element: /home/runner/work/***/***
so If I add the following step to the worklow:
- name: Override Coverage Source Path for Sonar
run: |
sed -i 's/<source>\/home\/runner\/work\/***\/***<\/source>/<source>\/github\/workspace<\/source>/g' coverage.xml
Then I don’t get the warning but the code is still empty
Any help would be appreciated.