Update .gitea/workflows/sonar.yml
All checks were successful
SonarQube Analysis / SonarQube Scan (push) Successful in 28s

This commit is contained in:
2026-02-18 16:24:23 +00:00
parent 7e2d250f1a
commit 5faf125fe7

View File

@@ -25,21 +25,40 @@ jobs:
with:
fetch-depth: 0
- name: Run SonarScanner (Docker v12)
# - name: Run SonarScanner (Docker v12)
# run: |
# # Safely get repository name from current directory
# PROJECT_KEY=$(basename "$PWD")
#
# echo "Using project key: $PROJECT_KEY"
#
# docker run --rm \
# -v "$PWD:/usr/src" \
# -w /usr/src \
# -e SONAR_HOST_URL=${{ secrets.SONARQUBE_HOST }} \
# -e SONAR_TOKEN=${{ secrets.SONARQUBE_TOKEN }} \
# sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1 \
# -Dsonar.projectKey=$PROJECT_KEY \
# -Dsonar.projectName=$PROJECT_KEY \
# -Dsonar.sources=. \
# -Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
# -Dsonar.qualitygate.wait=true
- name: Run SonarScanner (Fixed for Gitea)
run: |
# Safely get repository name from current directory
PROJECT_KEY=$(basename "$PWD")
echo "Using project key: $PROJECT_KEY"
# Use Gitea-native repo name
REPO_NAME=${{ gitea.event.repository.name }}
docker run --rm \
-v "$PWD:/usr/src" \
--user root \
-v "${{ gitea.workspace }}:/usr/src" \
-w /usr/src \
-e SONAR_HOST_URL=${{ secrets.SONARQUBE_HOST }} \
-e SONAR_TOKEN=${{ secrets.SONARQUBE_TOKEN }} \
sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1 \
-Dsonar.projectKey=$PROJECT_KEY \
-Dsonar.projectName=$PROJECT_KEY \
-Dsonar.projectKey=$REPO_NAME \
-Dsonar.projectName=$REPO_NAME \
-Dsonar.sources=. \
-Dsonar.scm.disabled=true \
-Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
-Dsonar.qualitygate.wait=true
-Dsonar.qualitygate.wait=true