Block github merge of pull requests when Sonacloud quality gate fails

Hello, general question, from github level, how can we block PRs from being merged if Sonarcloud scan fails ? and How do developer/author of a branch get notified when their build/quality gate fails?

Thanks in advance

Hello @Juan_Jose,

Are you using GitHub checks? If so, you can mark the SonarCloud check as mandatory, this will make merging the PR impossible if that check fails.

If you’re not using GitHub checks could you share a bit more about your set-up?

Hi Tom,

I am having this issue where the SC scan is failing the quality gate but the PR is not being blocked from being merged. How do I mark the SC check as mandatory?

this is what my action file step looks like:

      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Nevermind, this guide had the answer:

1 Like