Skip to content

Commit af31855

Browse files
committed
ci: fix missing secret checks for sonarcloud workflow
1 parent 281c045 commit af31855

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,46 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
# Check out current repository
15-
- name: Fetch Sources
16-
uses: actions/checkout@v4
17-
with:
18-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
19-
2014
# Load secrets from 1Password
2115
- name: Load secrets from 1Password
2216
uses: 1password/load-secrets-action@v2
17+
if: ${{ env.OP_SERVICE_ACCOUNT_TOKEN != null }}
2318
with:
2419
export-env: true
2520
env:
2621
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
2722
SONAR_TOKEN: op://ddev-intellij-plugin-secrets/Sonar Token/credential
2823

24+
# Check out current repository
25+
- name: Fetch Sources
26+
uses: actions/checkout@v4
27+
if: ${{ env.SONAR_TOKEN != null }}
28+
with:
29+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
30+
2931
# Validate wrapper
3032
- name: Gradle Wrapper Validation
33+
if: ${{ env.SONAR_TOKEN != null }}
3134
uses: gradle/actions/wrapper-validation@v4
3235

3336
# Set up Java environment for the next steps
3437
- name: Setup Java
38+
if: ${{ env.SONAR_TOKEN != null }}
3539
uses: actions/setup-java@v4
3640
with:
3741
distribution: zulu
3842
java-version: 21
3943

4044
# SonarCloud Cache
4145
- name: 'Cache: SonarCloud'
46+
if: ${{ env.SONAR_TOKEN != null }}
4247
uses: actions/cache@v4
4348
with:
4449
path: ~/.sonar/cache
4550
key: ${{ runner.os }}-sonar
4651

4752
- name: Run sonarqube
53+
if: ${{ env.SONAR_TOKEN != null }}
4854
uses: gradle/gradle-build-action@v3
4955
with:
5056
arguments: -Dtest.ignoreFailures=true sonarqube --info --stacktrace

0 commit comments

Comments
 (0)