We’re trying to split our Github actions and move Sonar code analysis to a separate workflow that is triggered after our Java CI workflow was completed successfully. Most of it looks good and promising but the check result is not reported anymore. It worked before when we executed Sonar within the Java CI pipeline. I can observe:
Sonarcloud adds the comment “Kudos, SonarCloud Quality Gate passed!”
I can find the PR on Sonarcloud
The code change was about moving the execution of the Gradle task to a new workflow that is triggered “on.workflow_run”.
Since our project is open source you can also have a look at the code changes:
There is quite a big difference in a way Github check and Github summary comment are added. Github summary comment is added in the context of the PR, whereas Github check is for a specific commit (does not matter if it is a PR or any other branch).
Are you sure that you are running the analysis on the commit that corresponds to the PR commit? I can see in the SonarCloud that the SHA of the commit is 877ea1ba where Github shows me 3b265149
I checked out the logs for the PR 1213 and the computed revision that we tried to decorate is: 3405e (run from the morning around 8:00). This kind of answers why you do not see the check on revision c8395.
The 3405e revision actually corresponds to the latest commit in the master branch. When looking at the previous analysis of this pull request, we also computed 1778b7 revisions which are also part of your master branch. I suspect that there may be some issues in the way the code is checked out and for some reason the analysis run on the master branch. Would you be able to verify it? For example print out the sha of the commit in the action?
Somehow the error must be connected to executing “sonarqube” in the workflow run. When we had it as part of the “Java CI” workflow it worked smoothly. Can you spot another error on our side?
Yes, overriding the sonar.scm.revision should fix the problem, as this value will be taken into consideration when creating a GitHub check. Let me know if this fixes problem for you!
Indeed, there has to be specific configuration here, that does not allow scanner to figure out the correct revision. I will look into the logs and see what I can find