From 5faf125fe7a74d4a114ad56100ebccb629ee35f2 Mon Sep 17 00:00:00 2001 From: Rajendra Reddy Date: Wed, 18 Feb 2026 16:24:23 +0000 Subject: [PATCH] Update .gitea/workflows/sonar.yml --- .gitea/workflows/sonar.yml | 39 ++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/sonar.yml b/.gitea/workflows/sonar.yml index 6417422..4342605 100644 --- a/.gitea/workflows/sonar.yml +++ b/.gitea/workflows/sonar.yml @@ -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