-
Notifications
You must be signed in to change notification settings - Fork 307
32 lines (27 loc) · 1.13 KB
/
sonar.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
name: Sonar
on:
workflow_run:
workflows: [Build-Test] # Trigger when the Build-Test workflow completes
types:
- completed # Trigger on completion of the Build-Test workflow
jobs:
SonarScanner:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' # Run job only if Build-Test workflow succeeded
steps:
# Checkout repository to ensure we have the latest code
- name: Checkout repository
uses: actions/checkout@v3
# Install Sonar Scanner
- name: Install Sonar Scanner
run: |
sudo apt-get update && sudo apt-get install -y unzip
wget -O /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
unzip /tmp/sonar-scanner-cli.zip -d /tmp
# Run SonarScanner for SunbirdEd-Portal
- name: Run SonarScanner for SunbirdEd-Portal
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Inject the SonarQube token securely
run: |
/tmp/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \
-Dsonar.login=$SONAR_TOKEN