Pull Request from Dev to Staging Branch show failed status check on individual commit item

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub)
  • CI system used (Github)
  • Scanner command used when applicable (private details masked): Automatic Analysis
  • Languages of the repository: Javascript
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce
  • Potential workaround

I am using sonarcloud automatic analysis in github. When we are creating a Pull Request from Dev to Staging, we can see sonarcloud status is pass, however we can see there are a lot of commits with failed status check. After clicking the link to sonar cloud for those failed one, it’s referring to the main branch analysis and not PR analysis. Is this behaviour expected ?

Hey there.

Are the particular commits in your pull request the same as one already on your main branch (from a rebase, perhaps)?

Hi Colin,

Yes, I believe those commits already in the main branch (Dev) and previously PR from another branch without issue in quality gate.

On your main branch (browsing the commits), do you see a green check or a red X next to those commits? Since they are considered the same commit in GitHub, the status should ultimately match (and this is expected).

Hi Colin,

I can see the commits are red X and it’s linked to main branch page in sonarcloud. And the main branch is currently failed on quality gate.

Compared to the PR analysis of the same commit, it’s showing green check.
Can you explain why the behavior is like this?

Thanks so much for your help!