Nx (Monorepo) + Sonar + Github Actions not working

ALM: GitHub
CI: Github
Scanner command:

      - name: Analyze with SonarCloud
        uses: sonarsource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        with:
          args: >
            -Dsonar.organization=lorum
            -Dsonar.projectKey=monoreponame-${{matrix.project}}
            -Dsonar.projectName=monoreponame-${{matrix.project}}
            -Dsonar.javascript.lcov.reportPaths=test-results/coverage/${{matrix.project}}/lcov.info
            -Dsonar.test.inclusions=**/*.spec.ts
            -Dsonar.sources=${{matrix.type}}/${{matrix.project}}
            -Dsonar.typescript.tsconfigPath=${{matrix.type}}/${{matrix.project}}/tsconfig.json
            -Dsonar.verbose=true

Languages: Typescript
Error: Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration

Workaround:

  1. Creating and adding each new project (app/lib) manually to Sonarcloud.
  2. Do a manual run to bypass the problem.

Problem: within our monorepo the amount of libs and apps is growing quite rapidly. The problem is gennerally a new app/lib is introduced by a pullrequest. So far as i know Sonarcloud expects a run on a main branch before allowinng pull requests, which works great for non monorepo projects.

Hi,

Welcome to the community!

Can you provide the full analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
HTH,
Ann