Skip to content

Commit

Permalink
Fix sonar action can't get PR number (#2048)
Browse files Browse the repository at this point in the history
Co-authored-by: hulk <[email protected]>
  • Loading branch information
jihuayu and git-hulk authored Jan 25, 2024
1 parent 044b6fd commit 8361174
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 8361174

Please sign in to comment.