Skip to content

Commit e95e6f0

Browse files
Merge pull request #15 from Clearfacts/CLEARFACTS-12646
CLEARFACTS-12646: Add project version to SonarQube scan
2 parents 369f35c + 30e92fd commit e95e6f0

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/sonarqube.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ jobs:
1010
sonarqube:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
14-
with:
15-
fetch-depth: 0
16-
- name: SonarQube Scan
17-
uses: SonarSource/sonarqube-scan-action@v5.1.0
18-
env:
19-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
20-
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
13+
- uses: actions/checkout@v4
14+
with:
15+
# Disabling shallow clones is recommended for improving the relevancy of reporting
16+
fetch-depth: 0
17+
- name: Resolve environment variables
18+
if: github.ref == 'refs/heads/master'
19+
shell: bash
20+
run: echo "BUILD_NUMBER=v${{ github.run_number }}" >> $GITHUB_ENV
21+
- name: SonarQube Scan
22+
uses: SonarSource/sonarqube-scan-action@v5.1.0 # Ex: v4.1.0, See the latest version at https://github.com/marketplace/actions/official-sonarqube-scan
23+
env:
24+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
25+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
26+
with:
27+
args: >
28+
${{ github.ref == 'refs/heads/master' && format('-Dsonar.projectVersion={0}', env.BUILD_NUMBER) || '' }}

0 commit comments

Comments
 (0)