How to conditionally disable sonarcloud app in github

I have a monorepo with multiple languages (java & python).
Currently sonarcloud is setup only for my java modules. The coverages reports are sent to sonar as part of the build process.
I’m doing selective builds to reduce build time, so if only python code changed, no java code will be built, and consequently, not sonar report will be sent for that branch.
As part of the github checks, we have sonarcloud app integrated which is setup as “required” and expects a sonar analysis for the branch in a pull request.
In the scenario when only python modules changed, the check will wait indefinitely.

Is there a way to configure the sonarcloud app to conditionally block the PR?
what are other alternatives i can apply?


Hey there.

The CI doesn’t report a check – the CI submits a report to SonarCloud, which decorates the PR with the check.

This is normally fine, but since required checks are… required, whether or not an analysis has been submitted for one doesn’t matter. GitHub will still require the check.

Hey there.

We would love for this to work – but it really relies on GitHub implementing some kind of feature around conditional checks.

There have been discussions on GitHub about some notion of “Conditional” status checks (based on what changed)… but I don’t think users have come to a super satisfying conclusion (only hacks) Github actions and required checks in a monorepo (using paths to limit execution) · Discussion #26251 · community · GitHub