New project fails to scan from Github action in new PR

Template for a good new topic, formatted with Markdown:

  • ALM used : GitHub
  • CI system used : Github Actions
  • Languages of the repository : golang
  • Error observed : Could not find a default branch to fall back on.
  • Logs :
INFO: Scanner configuration file: /opt/sonar-scanner/conf/
INFO: Project root configuration file: /github/workspace/
INFO: SonarScanner
INFO: Java 11.0.19 Alpine (64-bit)
INFO: Linux 5.15.0-1037-azure amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Analyzing on SonarCloud
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=531ms
INFO: Server id: IDS
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=519ms
INFO: Load/download plugins (done) | time=26033ms
INFO: Loaded core extensions: developer-scanner
INFO: Found an active CI vendor: 'Github Actions'
INFO: Load project settings for component key: 'myrepo'
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: myrepo
INFO: Base dir: /github/workspace
INFO: Working dir: /github/workspace/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=468ms
INFO: Check ALM binding of project 'my-repo'
INFO: Detected project binding: NONEXISTENT
INFO: Check ALM binding of project 'myrepo' (done) | time=493ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=491ms
INFO: Load branch configuration
INFO: Github event: push
INFO: Auto-configuring branch test-sonarcloud
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 34.387s
INFO: Final Memory: 19M/67M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Could not find a default branch to fall back on.
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
  • Steps to reproduce :
  1. add repo in github sonarcloud app
  2. add repo in sonarcloud project management
  3. verify auto analysis completes
  4. disable auto analysis
  5. push new commit to branch that has the new github action
  6. wait for error
  • Potential workaround: Execute the sonar-scanner locally?

Figured it out!
Looked at the verbose logs and it was giving a 404 on the lookup for the project key.
Checked the ui for the project key which was <org name>_myrepo ,but our file has myteam_myrepo.
Updated the key in the ui to myteam_myrepo and reran my gh action and got a :green_circle:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.