Add actions/sonar/action.yml
This commit is contained in:
49
actions/sonar/action.yml
Normal file
49
actions/sonar/action.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
name: "SonarQube Scan"
|
||||
description: "Run SonarQube scan with Quality Gate enforcement"
|
||||
|
||||
inputs:
|
||||
sonar_host_url:
|
||||
required: true
|
||||
|
||||
sonar_token:
|
||||
required: true
|
||||
|
||||
wait_for_quality_gate:
|
||||
required: false
|
||||
default: "true"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set Project Key (from repo name)
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PROJECT_KEY=${{ gitea.event.repository.name }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Debug Info
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Project Key: $PROJECT_KEY"
|
||||
echo "Wait for Quality Gate: ${{ inputs.wait_for_quality_gate }}"
|
||||
|
||||
- name: Run Sonar Scanner
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ inputs.wait_for_quality_gate }}" = "true" ]; then
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=$PROJECT_KEY \
|
||||
-Dsonar.projectName=$PROJECT_KEY \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=${{ inputs.sonar_host_url }} \
|
||||
-Dsonar.token=${{ inputs.sonar_token }} \
|
||||
-Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
|
||||
-Dsonar.qualitygate.wait=true
|
||||
else
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=$PROJECT_KEY \
|
||||
-Dsonar.projectName=$PROJECT_KEY \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=${{ inputs.sonar_host_url }} \
|
||||
-Dsonar.token=${{ inputs.sonar_token }} \
|
||||
-Dsonar.exclusions=node_modules/**,dist/**,coverage/**
|
||||
fi
|
||||
Reference in New Issue
Block a user