This is an automated email from the ASF dual-hosted git repository.

binbin pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new cbede1b4 Fix Sonar CI fail in unstable branch (#2052)
cbede1b4 is described below

commit cbede1b4523676fdd3446477f667023f63090682
Author: Twice <[email protected]>
AuthorDate: Thu Jan 25 23:39:49 2024 +0900

    Fix Sonar CI fail in unstable branch (#2052)
    
    We should output empty instead of `null` as PR number for unstable branch.
---
 .github/workflows/sonar.yaml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml
index 21d87efd..918488a7 100644
--- a/.github/workflows/sonar.yaml
+++ b/.github/workflows/sonar.yaml
@@ -72,11 +72,13 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
         run: |
-          pr_number=$(jq -r '.number' sonarcloud-data/github-event.json)
+          PR_NUMBER=$(jq -r '.number | select (.!=null)' 
sonarcloud-data/github-event.json)
+          echo "The PR number is $PR_NUMBER"
+
           sonar-scanner \
             --define sonar.cfamily.build-wrapper-output="sonarcloud-data" \
             --define sonar.coverageReportPaths=sonarcloud-data/coverage.xml \
             --define sonar.projectKey=apache_kvrocks \
             --define sonar.organization=apache \
             --define sonar.scm.revision=${{ github.event.workflow_run.head_sha 
}} \
-            --define sonar.pullrequest.key="$pr_number"
+            --define sonar.pullrequest.key=$PR_NUMBER

Reply via email to