I have found the rename API endpoint but it doesn’t work without issues (If the branch i want to have as main branch already exists, I get an error).
Also, I seem to remember that SonarCloud was supposed to take over the main branch defined in BitBucket (I can’t currently find the source for this though).
Are there any plans for this behavior to change in the near future?
I currently manage 50+ projects that are read from Bitbucket with a provisioning script and then created/updated in various CI/CD tools (SonarCloud included).
The main-branches in BitBucket are partly changed and have to be updated accordingly in SonarCloud. Therefore, it is mainly about this use case and not about the initial provisioning.
I can confirm that in this case, the main branch won’t be set correctly by default (coming back to the conversation here, it’s because the project isn’t bound).
And, even when a project is bound, should the default branch change… you’re stuck in this situation as well.
So for now, you have to either rename the main branch (and lose history / have a history that actually represents two branches).
I’ll move this to Suggest New Features so that it can get attention from the right folks, and maybe get some votes.