|
33 | 33 | repository: ${{ github.event.workflow_run.head_repository.full_name }} |
34 | 34 | ref: ${{ github.event.workflow_run.head_sha }} |
35 | 35 | fetch-depth: 0 |
36 | | - - name: Install sonar-scanner and build-wrapper |
37 | | - uses: SonarSource/sonarcloud-github-c-cpp@v3 |
| 36 | + - name: Install Build Wrapper |
| 37 | + uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6.0.0 |
38 | 38 | - name: 'Download code coverage' |
39 | 39 | uses: actions/github-script@v7 |
40 | 40 | with: |
@@ -66,18 +66,22 @@ jobs: |
66 | 66 | with: |
67 | 67 | python-version: 3.x |
68 | 68 |
|
69 | | - - name: Run sonar-scanner |
70 | | - env: |
71 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
72 | | - SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} |
| 69 | + - name: Extract PR number |
73 | 70 | run: | |
74 | 71 | PR_NUMBER=$(jq -r '.number | select (.!=null)' sonarcloud-data/github-event.json) |
75 | | - echo "The PR number is $PR_NUMBER" |
| 72 | + echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_ENV" |
| 73 | + echo "The PR number is ${PR_NUMBER:-<none>}" |
76 | 74 |
|
77 | | - sonar-scanner \ |
78 | | - --define sonar.cfamily.build-wrapper-output="sonarcloud-data" \ |
79 | | - --define sonar.coverageReportPaths=sonarcloud-data/coverage.xml \ |
80 | | - --define sonar.projectKey=apache_kvrocks \ |
81 | | - --define sonar.organization=apache \ |
82 | | - --define sonar.scm.revision=${{ github.event.workflow_run.head_sha }} \ |
83 | | - --define sonar.pullrequest.key=$PR_NUMBER |
| 75 | + - name: SonarQube Scan |
| 76 | + uses: SonarSource/sonarqube-scan-action@v6.0.0 |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} |
| 80 | + with: |
| 81 | + args: > |
| 82 | + -Dsonar.cfamily.build-wrapper-output=sonarcloud-data |
| 83 | + -Dsonar.coverageReportPaths=sonarcloud-data/coverage.xml |
| 84 | + -Dsonar.projectKey=apache_kvrocks |
| 85 | + -Dsonar.organization=apache |
| 86 | + -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} |
| 87 | + -Dsonar.pullrequest.key=${{ env.PR_NUMBER }} |
0 commit comments