-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (38 loc) · 1.23 KB
/
sonarqube.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: NSoft SonarQube Analysis
on:
push:
branches:
- master
- next
pull_request:
jobs:
sq_scan_job:
runs-on: ubuntu-latest
name: SonarQube scan
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup sonarqube
uses: warchant/setup-sonar-scanner@v3
- name: Run sonarqube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run:
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
echo "$GITHUB_EVENT_NAME" &&
sonar-scanner
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
-Dsonar.branch.name=${GITHUB_REF#refs/heads/};
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
echo "$GITHUB_EVENT_NAME" &&
sonar-scanner
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }};
fi