GitHub Actions - 'Could not find a default branch' error with free SonarCloud account."

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps) - Github

  • Scanner command used when applicable (private details masked)

  • jobs:
    scan:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
    uses: actions/checkout@v4

    - name: SonarCloud Scan
      uses: SonarSource/sonarqube-scan-action@v3
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
      with:
        args: >-
          -Dsonar.organization=orgname(I used my org)
          -Dsonar.projectKey=(My project name)
          -Dsonar.sources=.
    
  • Languages of the repository - python
    ERROR Could not find a default branch for project with key ‘project name’. Make sure project exists.

Hi,

Welcome to the community!

Could we have 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.

 
Thx,
Ann