File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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) || '' }}
You can’t perform that action at this time.
0 commit comments