Skip to content

Commit c46a21e

Browse files
authored
Merge pull request #227 from catenax-ng/sonar
chr: use SONAR_PROJECT_KEY and SONAR_ORGANIZATION env vars in build
2 parents cee5de5 + 1a49cdc commit c46a21e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@ jobs:
2424
cmd: install # will run `yarn install` command
2525
- name: Run npm test:ci
2626
run: CHROMIUM_BIN=$(which chrome) npm run test:ci # will run `test:ci` command
27-
- uses: SonarSource/sonarcloud-github-action@master
27+
- name: Run SonarCloud with organzation and project key from environment
28+
uses: SonarSource/sonarcloud-github-action@master
29+
if: ${{ env.SONAR_ORGANIZATION != '' && env.SONAR_PROJECT_KEY != '' }}
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
32+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
33+
with:
34+
args: >
35+
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }}
36+
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
37+
- name: Run SonarCloud with hardcoded organization and project key
38+
uses: SonarSource/sonarcloud-github-action@master # Fallback for the catenax-ng/product-traceability-foss-frontend
39+
if: ${{ env.SONAR_ORGANIZATION == '' || env.SONAR_PROJECT_KEY == '' }}
2840
env:
2941
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
3042
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)