SonarScan not reading code coverage from github actions

i have a github action where the test step is run inside a container like this:

(non-important bits removed)

test:
    needs: [build-and-push, setup-context]
    name: Lint-Typecheck-Migrations-Tests
    runs-on: ubuntu-latest
    container:
      image: my-container
    steps:
      - name: Check out current project
        uses: actions/checkout@v3
        with:
          submodules: recursive
          ssh-key: ${{ env.AVANTBOT_SSH_KEY }}
      - name: test
        run: |
          cd /code
          coverage run manage.py test
          coverage xml
          sed -i "s/<source>.*<\/source>/<source>\/github\/workspace\/app<\/source>/g" coverage.xml
          head coverage.xml
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

the SonarCloud Scan (which runs in its own container) is not picking up the coverage.xml file that is generated by the coverage command.

the coverage path is specified as sonar.python.coverage.reportPaths = **/coverage.xml

i have a feeling its because the action is run inside a container on the github hosted runner and then sonarcloud runs in its own container.

how do i get sonarcloud to see the coverage file that was generated in the previous step?

Hey there.

You can use the Github Actions upload-artifact and download-artifact to share data between jobs..

And if you still have trouble, I suggest checking out this post: