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

twice 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 8361174b Fix sonar action can't get PR number (#2048)
8361174b is described below

commit 8361174b652f83217c80d7ebcefbe4163d958624
Author: 纪华裕 <[email protected]>
AuthorDate: Thu Jan 25 20:31:56 2024 +0800

    Fix sonar action can't get PR number (#2048)
    
    Co-authored-by: hulk <[email protected]>
---
 .github/workflows/sonar.yaml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml
index 4f91bfc9..21d87efd 100644
--- a/.github/workflows/sonar.yaml
+++ b/.github/workflows/sonar.yaml
@@ -72,12 +72,11 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
         run: |
+          pr_number=$(jq -r '.number' sonarcloud-data/github-event.json)
           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=${{ 
github.event.workflow_run.pull_requests[0].number }} \
-            --define sonar.pullrequest.branch=${{ 
github.event.workflow_run.pull_requests[0].head.ref }} \
-            --define sonar.pullrequest.base=${{ 
github.event.workflow_run.pull_requests[0].base.ref }}
+            --define sonar.pullrequest.key="$pr_number"

Reply via email to