Skip to content

Commit 6e69f3c

Browse files
committed
chr: use SONAR_PROJECT_KEY and SONAR_ORGANIZATION env vars in build
The new repos will have these vars set. For now the build falls back to the previous values, if the variables are not set.
1 parent cee5de5 commit 6e69f3c

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: ${{ vars.SONAR_ORGANIZATION != '' && vars.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=${{ vars.SONAR_ORGANIZATION }}
36+
-Dsonar.projectKey=${{ vars.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: ${{ vars.SONAR_ORGANIZATION == '' || vars.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)