Import GitHub repo to SonarCloud using API

Hello everyone,
I know that we can create new Sonar cloud projects from API, but doing so sonar cloud creates a separate project with same name but not linked to the github project.

I basically want to automate the Import function (see the picture) thats available on UI.

Welcome to the community!

Our API currently does not support the automation of this functionality.

Can you please tell us more about your use case? Why is the feature on the UI not suitable or practical for you?

Thanks
Janos

Thanks @janos , so basically two things.
We imported all of our old projects from Github this way, and now we have a bot to create new GitHub repos, we would like to integrate Sonarcloud to that process. But we found that creating Sonarcloud project through API will create a different kind of project that is different from importing from GitHub. Please see the image attached. Any input would be appreciated.

Any news on this?
We are using terraform to create Sonar projects but they don’t seem to have any link to the GitHub repo.
If we are creating projects through the API, is there a way to provide the repo link somehow to Sonar e.g. as part of the analysis done in the CI system?

I can imagine that when creating GitHub repos with a bot it may make sense to integrate SonarCloud with a bot too. Can you explain more about the use case to create repos with a bot?

Welcome to the conversation. Can you please explain why you need to create SonarCloud projects using terraform, and why it is not an option to use the UI?

For the record, I’m not pushing back on your requests, I’m just trying to understand your needs better.

This is not possible at the moment. The link is only created when importing using the UI.

Hello Janos,

Adding the possibility of importing repos using API or other tooling (like CLI) provides capability to automate this task in workflows/pipelines. Otherwise, it will require manual action to have our projects imported in SonarCloud.
This limitation is preventing us to have a fully automated pipeline when using “template repositories”, so all the templated/children repos are missing in SonarCloud and we need to manually import them

1 Like

Hello Sonar team, any update on this?

Currently, it is blocking us to automate our CI strategy. We have automation to create GitHub repos, ADO pipelines and the only missing part is the SonarCloud linked to GitHub.

Could we expect this feature to be implemented?

Is there any updates here?
This is blocking my CI strategy. We have a cookiecutter that builds a github repo and integrates the repo with several tools but not sonarcloud because you don’t seem to support this.
This is a must have feature for me as I need to reduce manual steps to near 0, if developers have to go to your UI, click some buttons before the checks will run then they wont and I’ll need to find a solution that provides this.

We are trying to implement IAC with SonarCloud and Terraform. One of the missing features is the creation of projects. Are there any updates on creating these with the SonarCloud api?

There are no updates yet.
You can follow the status of this feature idea on our roadmap for updates.