Skip to content

Commit 6e4e213

Browse files
committed
Fix Sonarqube scanner in GHA
1 parent 20cc873 commit 6e4e213

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,39 @@ jobs:
4444
- name: npm build
4545
run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build
4646

47+
- name: SonarQube Scan (Push)
48+
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master') }}
49+
uses: SonarSource/sonarcloud-github-action@v1.8
50+
env:
51+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
52+
with:
53+
projectBaseDir: .
54+
args: >
55+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
56+
-Dsonar.projectName=${{ github.event.repository.name }}
57+
-Dsonar.projectKey=${{ github.event.repository.name }}
58+
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
59+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
60+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
61+
62+
- name: SonarQube Scan (Pull Request)
63+
if: github.event_name == 'pull_request'
64+
uses: SonarSource/sonarcloud-github-action@v1.8
65+
env:
66+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
67+
with:
68+
projectBaseDir: .
69+
args: >
70+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
71+
-Dsonar.projectName=${{ github.event.repository.name }}
72+
-Dsonar.projectKey=${{ github.event.repository.name }}
73+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
74+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
75+
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
76+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
77+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
78+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
79+
4780
- name: Store assets
4881
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master') }}
4982
uses: actions/upload-artifact@v3
@@ -137,36 +170,3 @@ jobs:
137170
SOURCE_DIR: ./umd
138171
DEST_DIR: sdk
139172
ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public
140-
141-
- name: SonarQube Scan (Push)
142-
if: github.event_name == 'push'
143-
uses: SonarSource/sonarcloud-github-action@v1.8
144-
env:
145-
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
146-
with:
147-
projectBaseDir: .
148-
args: >
149-
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
150-
-Dsonar.projectName=${{ github.event.repository.name }}
151-
-Dsonar.projectKey=${{ github.event.repository.name }}
152-
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
153-
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
154-
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
155-
156-
- name: SonarQube Scan (Pull Request)
157-
if: github.event_name == 'pull_request'
158-
uses: SonarSource/sonarcloud-github-action@v1.8
159-
env:
160-
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
161-
with:
162-
projectBaseDir: .
163-
args: >
164-
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
165-
-Dsonar.projectName=${{ github.event.repository.name }}
166-
-Dsonar.projectKey=${{ github.event.repository.name }}
167-
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
168-
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
169-
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
170-
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
171-
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
172-
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}

0 commit comments

Comments
 (0)