Is there a way to exclude some branches from SonarQube scanning?

In our mono repo, the “SonarQube Analysis” is turned on as a required check on GitHub. Unfortunately, in this case, there is no way not to start the SQ scanner for certain branches (if it’s a required check, GitHub expects it to be always addressed one way or another (in
success/failed/pending status).

One option is to not provide any sources for scanning, but it seems a bit hacky, and also it consumes precious resources…

Instead of doing this is there any way to simply ignore some certain branches (e.g. since we have SQ as a required check for every PR, we don’t need it to scan a master branch and we would like to exclude it)?

Thank you

Hi there. I am not 100% sure what you are trying to accomplish. Could you perhaps give more information as to which edition you are using, and how you set up your GitHub actions.

Thanks :slight_smile:

Reviving an old thread as I have the same need. To provide some context, we have a bot which maintains and automatically upgrades dependencies. The are some edge cases in which the bot will open a PR which gets blocked by sonar, but honestly we rather just allow the automatic merge to happen for these rather than getting it blocked in these cases. However, these PRs are prefixed – so I want to just have the scanner run and push something that tells sonarqube pass the PR for now for the branches which have the appropriate automated/ branch prefix.

Hi @RyanH,

You need the selectivity to happen before analysis: just don’t analyze the bot’s PRs.

And since this is an old thread, I’m going to close it now.