# Github and sonarcloud

**URL:** <https://community.sonarsource.com/t/github-and-sonarcloud/4342>\
**Category:** SonarQube Cloud\
**Tags:** github, sonarqube-cloud\
**Created:** [November 16, 2018, 11:42am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342 "2018-11-16T11:42:18Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrik](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@patrik](https://community.sonarsource.com/u/patrik)\
**Post date:** [November 16, 2018, 11:42am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/1 "2018-11-16T11:42:18Z")

</div>

We are trying to add sonarcloud analyze to our pull requests in github.

We have installed the app sonarcloud app [https://github.com/apps/sonarcloud](https://github.com/apps/sonarcloud), and tried to read the documentation [https://sonarcloud.io/documentation/integrations/github/](https://sonarcloud.io/documentation/integrations/github/) but we cannot get it to work.

Can anyone explain in more detail what we need to do to get the [sonarcloud.io](http://sonarcloud.io) analyze result visible in the PR in github?

We are using azure devops as CI to trigger builds.

---

<div class="post-metadata">

**Author:** ![dbolkensteyn](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dbolkensteyn/32/46_2.png) [@dbolkensteyn](https://community.sonarsource.com/u/dbolkensteyn)\
**Post date:** [November 19, 2018, 6:45am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/2 "2018-11-19T06:45:41Z")

</div>

Hi @patrik

The following pages provide additional information on how to integrate Azure DevOps with GitHub pull requests:

- [https://sonarcloud.io/documentation/integrations/vsts/](https://sonarcloud.io/documentation/integrations/vsts/)
- [https://aka.ms/sonarcloudlab](https://aka.ms/sonarcloudlab)
- [https://docs.microsoft.com/en-us/labs/devops/sonarcloudlab/index?tutorial-step=4](https://docs.microsoft.com/en-us/labs/devops/sonarcloudlab/index?tutorial-step=4)

Let us know if you need any further help.

---

<div class="post-metadata">

**Author:** ![patrik](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@patrik](https://community.sonarsource.com/u/patrik)\
**Post date:** [November 19, 2018, 2:56pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/3 "2018-11-19T14:56:35Z")

</div>

I am looking for [sonarcloud.io](http://sonarcloud.io) to post analyze comments to github (as seen in the screenshot below).

 ![](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/8/8a25e8b4d1f791af4e04da1bd07c0e7926c654ed.png)

Is there some specific parameters that I must set in the “Prepare analysis on SonarCloud”-step in azure devops?

We are reviewing the PR in github, we only use azure devops to build and deploy.

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [November 21, 2018, 1:02pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/4 "2018-11-21T13:02:28Z")

</div>

This should work out of the box if you have installed the SonarCloud GitHub Application: [https://github.com/apps/sonarcloud](https://github.com/apps/sonarcloud)

(this is what our .NET team is doing at SonarSource - cc @Ammo)

---

<div class="post-metadata">

**Author:** ![patrik](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@patrik](https://community.sonarsource.com/u/patrik)\
**Post date:** [November 22, 2018, 11:26am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/5 "2018-11-22T11:26:42Z")

</div>

Ok, it doesn’t work for me. But I get this permission requests when I try to install it.  
Our setup is that we have a Organization account and not a personal account. Could that be an issue?

![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/6/6065ae3e771f7f50af7ba9f2b8421eaa7d1b888d.png)

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [December 4, 2018, 5:16pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/6 "2018-12-04T17:16:02Z")

</div>

This should work on an organization account Patrik. Have you accepted the permissions?

---

<div class="post-metadata">

**Author:** ![patrik](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@patrik](https://community.sonarsource.com/u/patrik)\
**Post date:** [December 5, 2018, 6:16am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/7 "2018-12-05T06:16:41Z")

</div>

I don’t know how I can accept the requested permissions.

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [December 5, 2018, 4:37pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/8 "2018-12-05T16:37:28Z")

</div>

OK, let’s see where you stand for now:

1. When you create a PR and pushes code on it, does this PR appear in SonarCloud? (a couple of minutes later) Something like:  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/0/0dc34a612178fc2cc5bca3026f277f489bb3e379.png)
  - If yes, this means that your Azure Pipeline does trigger successfully the analysis, then go to question #2
  - If no, this means that you have an issue with your job on Azure Pipeline: you need to run it in debug mode and with `sonar.verbose=true` properties to see what’s going wrong in the logs

2. So you see the PR in SonarCloud: click on it to go on the details page. Do you see a warning on the right side, like:  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/c/cbf5a89b0c3250be4c0255f091797a48b8feb523.png)
  - If yes, what does it say?

---

<div class="post-metadata">

**Author:** ![patrik](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@patrik](https://community.sonarsource.com/u/patrik)\
**Post date:** [December 6, 2018, 8:39am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/9 "2018-12-06T08:39:39Z")

</div>

1. Yes I see the branches in SonarCloud. However I noticed they have the label “Short-lived branches” and not Pull Requests. That is probably some part of the issue.

![38%20AM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/d/d9fc847df0379df4d742a8cb1ec1bd9f5667fef4.png)

When I changed the CI to trigger on PR instead then I got this error:  
ERROR: Pull request with branch does not exist on server: development

That is probably because my PR are based on the “development” branch, but the main branch in sonarcloud is master.

Is is possible to have both master and development in the same project and let the PR be based on the development branch?

Because I want to follow statistics / code quality on the master branch, but during development I want to follow the quality on each PR.

Or do I need to create two different projects for this in sonarcloud?

---

<div class="post-metadata">

**Author:** ![patrik](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@patrik](https://community.sonarsource.com/u/patrik)\
**Post date:** [December 6, 2018, 9:27am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/10 "2018-12-06T09:27:28Z")

</div>

I renamed the main branch to ‘development’ in sonarcloud and then everything started to work. So now it comment on the PR commits.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [December 7, 2018, 1:07pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/11 "2018-12-07T13:07:12Z")

</div>

Glad you managed to get out of this Patrik!

---

<div class="post-metadata">

**Author:** ![alexvicegrab](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/alexvicegrab/32/2356_2.png) [@alexvicegrab](https://community.sonarsource.com/u/alexvicegrab)\
**Post date:** [January 29, 2019, 6:29pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/12 "2019-01-29T18:29:22Z")

</div>

@Fabrice_Bellingard, I’m seeing a similar issue. Is there any way of tracking multiple long-lived branches on SonarCloud/GitHub?

For some reason, SonarCloud only detected the master branch, and the regex pattern I provided `(master|develop).*` to detect the master and develop branches as long-lived does nothing. Furthermore, I don’t see any of the feature branches featured as short-lived either. It looks to me like a bug, please assist.

---

<div class="post-metadata">

**Author:** ![julienlancelot](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julienlancelot/32/68225_2.png) [@julienlancelot](https://community.sonarsource.com/u/julienlancelot)\
**Post date:** [January 29, 2019, 7:45pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/13 "2019-01-29T19:45:06Z")

</div>

@alexvicegrab Your issue is different from the one reported by this thread, and moreover you’ve opened a new thread on your issue [Having multiple long-lived branches on GitHub](https://community.sonarsource.com/t/having-multiple-long-lived-branches-on-github/6280) -\> adding a comment here will not help you to get a quicker answer.

---

<div class="post-metadata">

**Author:** ![alexvicegrab](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/alexvicegrab/32/2356_2.png) [@alexvicegrab](https://community.sonarsource.com/u/alexvicegrab)\
**Post date:** [January 29, 2019, 10:50pm UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/14 "2019-01-29T22:50:18Z")

</div>

Fair enough, but the requirement of the asker was also to have multiple long-term branches. I considered he or Fabrice may have possible comments regarding my own issue.

---

<div class="post-metadata">

**Author:** ![vitalykarasik](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vitalykarasik/32/6737_2.png) [@vitalykarasik](https://community.sonarsource.com/u/vitalykarasik)\
**Post date:** [January 30, 2019, 8:17am UTC](https://community.sonarsource.com/t/github-and-sonarcloud/4342/15 "2019-01-30T08:17:33Z")

</div>

Do you mean “master” branch?
