diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index 4f91bfc95e8..21d87efdedd 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"