Skip to content

Commit e3877cf

Browse files
committed
Fix SonarQube error and refine trigger conditions
The SonarQube weekly analysis workflow was failing due to a missing `compile_commands.json` file. This occurs because the build-wrapper output directory was previously referenced with an incorrect path containing an unintended quotation mark, causing the CFamily plugin to abort with a NoSuchFileException. This change fixes the failure by aligning the workflow with SonarCloud recommended usage. Additionally, this commit updates the workflow triggers: - `push` now explicitly targets the `main` branch; - `pull_request` now includes path-level filters so that the workflow runs whenever the workflow file itself is modified.
1 parent 435b8aa commit e3877cf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/sonarqube.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
# Triggers:
3333
# - Weekly schedule
3434
# - optional manual dispatch.
35+
# - Changes on sonarqube.yml file
3536
#
3637
# Notes:
3738
# - SONARCLOUD_TOKEN secret is provided by the ASF Infra team
@@ -42,6 +43,14 @@ on:
4243
schedule:
4344
- cron: "0 0 * * 1"
4445
workflow_dispatch:
46+
push:
47+
branches:
48+
- main
49+
paths:
50+
- '.github/workflows/sonarqube.yml'
51+
pull_request:
52+
paths:
53+
- '.github/workflows/sonarqube.yml'
4554

4655
permissions:
4756
contents: read
@@ -117,4 +126,4 @@ jobs:
117126
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
118127
with:
119128
args: >
120-
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
129+
--define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"

0 commit comments

Comments
 (0)