Skip to content

Commit 334aa61

Browse files
author
Andreas Wuerl (ext.)
committed
skip Sonar if secrets are not accessible
1 parent ef29409 commit 334aa61

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,20 @@ jobs:
3737

3838
- name: Cache SonarQube packages
3939
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
40+
if: ${{ github.secret_source == 'Actions' }}
4041
with:
4142
path: ~/.sonar/cache
4243
key: ${{ runner.os }}-sonar
4344
restore-keys: ${{ runner.os }}-sonar
4445

4546
- name: Build and analyze
47+
if: ${{ github.secret_source == 'None' }}
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
50+
run: ./gradlew build jacocoTestReport
51+
52+
- name: Build and analyze (Sonar)
53+
if: ${{ github.secret_source == 'Actions' }}
4654
env:
4755
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4856
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)