File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 2424 SONARCLOUD_HOST : https://sonarcloud.io
2525
2626jobs :
27+ token-check :
28+ runs-on : ubuntu-latest
29+ outputs :
30+ hasToken : ${{ steps.check-token.outputs.has }}
31+ steps :
32+ - name : Check Token
33+ id : check-token
34+ run : |
35+ [ -z $SONAR_TOKEN ] && echo "has=false" || echo "has=true" >> "$GITHUB_OUTPUT"
36+ env :
37+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
38+
2739 sonar :
2840 name : SonarCloud Scan
2941 runs-on : ubuntu-latest
30- if : ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
42+ needs : token-check
43+ if : ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) && needs.token-check.outputs.hasToken }}
3144 steps :
3245 - uses : actions/checkout@v4
3346 with :
3447 fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
3548
3649 - name : Set up JDK
37- if : ${{ secrets.SONAR_TOKEN != '' }}
3850 uses : actions/setup-java@v4
3951 with :
4052 distribution : ' temurin'
4153 java-version : 17
4254
4355 - name : Cache SonarCloud packages
44- if : ${{ secrets.SONAR_TOKEN != '' }}
4556 uses : actions/cache@v4
4657 with :
4758 path : ~/.sonar/cache
4859 key : ${{ runner.os }}-sonar
4960 restore-keys : ${{ runner.os }}-sonar
5061
5162 - name : Cache Maven packages
52- if : ${{ secrets.SONAR_TOKEN != '' }}
5363 uses : actions/cache@v4
5464 with :
5565 path : ~/.m2
5666 key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
5767 restore-keys : ${{ runner.os }}-m2
5868
5969 - name : Build with Maven
60- if : ${{ secrets.SONAR_TOKEN != '' }}
6170 run : |
6271 ./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
6372 -DskipTests \
You can’t perform that action at this time.
0 commit comments