Align central and quality workflows with repository secret names SONARQUBE_HOST and SONARQUBE_TOKEN and pass them to sonar-scanner via environment variables. Made-with: Cursor
36 lines
907 B
YAML
36 lines
907 B
YAML
name: SonarQube Quality Gate
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
project_key:
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
SONARQUBE_HOST:
|
|
required: true
|
|
SONARQUBE_TOKEN:
|
|
required: true
|
|
|
|
jobs:
|
|
sonarqube:
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
image: sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1
|
|
options: --user root
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Run SonarQube Scan (with Quality Gate)
|
|
env:
|
|
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
|
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
|
run: |
|
|
sonar-scanner \
|
|
-Dsonar.projectKey=${{ inputs.project_key }} \
|
|
-Dsonar.projectName=${{ inputs.project_key }} \
|
|
-Dsonar.sources=. \
|
|
-Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
|
|
-Dsonar.qualitygate.wait=false |