This could be related to a misconfiguration of the project key or organization. Could you check if the project key you provided matches the project key on SonarCloud?
If the key is correctly configured could you share the log output of the GitHub action?
I get the following error in the analyze fase (https://github.com/sirups/Sirups.Essentials.Mvc/runs/810083444?check_suite_focus=true#step:10:59):
INFO: Total time: 31.652s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 25M/125M
ERROR: Could not find a default branch to fall back on.
INFO: ------------------------------------------------------------------------
ERROR:
The SonarQube Scanner did not complete successfully
06:07:21.573 Post-processing failed. Exit code: 1
##[error]Process completed with exit code 1.
Can you double check that your main branch is the default one on SonarCloud ? If you go to Administration -> Branches and pull request, there should be a label “MAIN BRANCH” beside the name of your default branch.
Thanks a bundle!
I have just verified that my “MAIN BRANCH” is “main”. (Which is as expected)
The action failed on the “main” branch.
EDIT: I think what I wrote was a bit unclear. So just to be on the safe side.
The “Thanks a bundle” was for welcoming me to the community.
As far as I can tell the project is correctly setup in SonarCloud. But I am still getting the error.
I tried running my Github Action before it was created. (My expectation was that it would be created automatically)
Since that didn’t happen I created it by choosing the repository
I tried deleting the project in SonarCloud and tried running the action again. I still get “Could not find a default branch to fall back on.”
I can’t see anything special about my repository. I have a branch protection rule preventing pushes to the release branch, but that shouldn’t be relevant here since my Main branch is “main” and the current branch I’m running on is “main”.
If I create it manually without “onboarding” I’m able to get it to work.
However this sets it up with a “master” default branch and my “main” branch as a “secondary” branch.
Is this some issue with SonarQube requiring a “master” branch or something like that?
I tried creating it all over again with the “onboarding” feature (which sets up my branches as they should be) and I get the “Could not find a default branch to fall back on.”.
my “wrong” projectKey was: sonar.projectKey=jekyll-kw-loremipsum I switched to sonar.projectKey=n13org_jekyll-kw-loremipsum (so i prefixed my project key with the org) and the scan was successfully done.