From c014e94bda3653f66414b7e688f90cf780f4eff5 Mon Sep 17 00:00:00 2001 From: Jacky Lam Date: Mon, 18 Nov 2024 19:49:27 +0000 Subject: [PATCH 1/2] docs: Add GitHub PR decoration args note See #920 --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index b82f9c78..91ff6520 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,21 @@ sonar.pullrequest.base = target_branch_name (e.g master) pull-request. These properties indicate to sonar that a branch is being analyzed rather than a pull-request so no pull-request decoration will be executed. +If you are scanning a GitHub pull request, you will also need to set the `sonar.scm.revision` argument. + +For example, using the official [SonarQube Scan](https://github.com/marketplace/actions/official-sonarqube-scan) +on GitHub Actions: + +```yaml +- name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@ + args: > + -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} +``` + ## Serving images for PR decoration By default, images for PR decoration are served as static resources on the SonarQube server as a part of Community From d5cc501dba0993857ad98467fc5210480b19bfed Mon Sep 17 00:00:00 2001 From: Jacky Lam Date: Wed, 18 Dec 2024 13:02:29 +0000 Subject: [PATCH 2/2] docs: Fix GitHub Actions syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stéphane Molano <51644881+molanostephane@users.noreply.github.com> --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91ff6520..3655c010 100644 --- a/README.md +++ b/README.md @@ -164,8 +164,9 @@ on GitHub Actions: ```yaml - name: SonarQube Scan uses: sonarsource/sonarqube-scan-action@ - args: > - -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} + with: + args: > + -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}