Skip to content

Commit 178e6bb

Browse files
committed
Forward Sonar params as secrets
1 parent 4e2fd4f commit 178e6bb

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/build-artifacts.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ on:
2222
required: false
2323
type: string
2424
default: ''
25+
secrets:
26+
SONAR_ORGANIZATION:
27+
required: false
28+
SONAR_PROJECT_KEY:
29+
required: false
30+
SONAR_TOKEN:
31+
required: false
2532

2633
jobs:
2734
build:
@@ -73,9 +80,9 @@ jobs:
7380
if: ${{ inputs.run-sonar }}
7481
env:
7582
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76-
SONAR_ORGANIZATION: ${{ inputs.sonar-organization }}
77-
SONAR_PROJECT_KEY: ${{ inputs.sonar-project-key }}
78-
SONAR_TOKEN: ${{ inputs.sonar-token }}
83+
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION || inputs.sonar-organization }}
84+
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY || inputs.sonar-project-key }}
85+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN || inputs.sonar-token }}
7986
run: |
8087
./gradlew sonar -Psonar.branch.name=${GITHUB_REF#refs/heads/} --info --scan
8188

.github/workflows/gradle-build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ jobs:
1515
# SonarQube requires JDK 17 or higher
1616
java-version: '17'
1717
run-sonar: true
18-
sonar-organization: ${{ secrets.SONAR_ORGANIZATION }}
19-
sonar-project-key: ${{ secrets.SONAR_PROJECT_KEY }}
20-
sonar-token: ${{ secrets.SONAR_TOKEN }}
18+
secrets:
19+
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
20+
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
21+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2122

2223
post-build:
2324
needs: build-artifacts

0 commit comments

Comments
 (0)