Support [sonar skip] commit message mechanism to skip pull request evaluation

We use your GitHub integration to great effect, but sometimes it’s wasting everyone’s resources.

For example, for draft PRs, where the goal is to test if the changes still compile on other platforms, there can be a lot of back and forth. Sonar will of course reevaluate with any extra commit or force push.

Beyond the first/last try this can be both useless (a waste of infrastructure) and annoying, since Sonar will comment again, typically triggering another email notification. Continuous integration services typically deal with this by allowing to skip the work if so dictated by the last commit message via extra tags. For example [ci skip] and [skip ci] are quite universal, but they usually also support more finegrained control, so you can just skip an individual service (e.g. skip actions, skip cirrus, skip appveyor).

It’d be great if SonarQube Cloud PR integration would support the same thing, namely [skip sonar] to avoid scanning and the waste of resources.

Hi @lynxlynxlynx,

Could you let me know which CI you’re using? Is it GitHub Actions?

If you’re using GitHub Actions, you might be able to control the SonarQube scan by adding a condition to the sonarqube-scan step, such as if: github.event.pull_request.draft == false, to prevent scans on draft pull requests.

Also, I’m not sure whether SonarQube Cloud’s Automatic Analysis scans draft PRs. If you’re using Automatic Analysis instead of CI-based scanning, please clarify!

We’re using all of the abovementioned CI services, but Sonar is triggered via GitHub Actions, yes. I’m almost certain it’s the Automatic Analysis version, since we don’t run it manually.

Above I meant “draft” in the general sense, but if that specific GA mechanism works like you say, that’s already an improvement.

The key difference is that if your workflow includes sonarqube-scan-action, you’re using a “manually” configured scan (even if it runs automatically because it’s in your workflow).

If there’s no such step in your workflow, SonarQube Cloud might rely on Automatic Analysis instead.

Yes, I checked, we don’t run it manually.

Refined version:

Thanks. Regarding this point:

At least it’s our infrastructure being used, not your’s—but that doesn’t address the issue with excessive notifications.

I confirmed that Automatic Analysis does run on Draft PRs. It might be useful to consider allowing users to toggle this behavior.

I’ve flagged this for our PMs to review. :slight_smile:

1 Like

Thanks. It’s also a matter of environmental efficiency, so it does not really matter whose resources are wasted — avoidance of needless work is good for both.

1 Like

Dear @lynxlynxlynx,

thank you very much for your feedback.

I have incorporated this in our backlog for consideration.

Best

Joan

1 Like