From a771bce8cc1a25338baa70f87c65e8918c40e13e Mon Sep 17 00:00:00 2001 From: Rajendra Reddy Date: Mon, 30 Mar 2026 02:47:26 +0000 Subject: [PATCH] Update .gitea/workflows/sonarscan.yml --- .gitea/workflows/sonarscan.yml | 52 ++++++++-------------------------- 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/.gitea/workflows/sonarscan.yml b/.gitea/workflows/sonarscan.yml index be6cc43..2fd3f17 100644 --- a/.gitea/workflows/sonarscan.yml +++ b/.gitea/workflows/sonarscan.yml @@ -1,19 +1,11 @@ -name: SonarQube Quality Gate +name: SonarQube Analysis on: push: - branches: - - testing - - main + branches: [ testing, main ] pull_request: - branches: - - testing - - main - -env: - SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} - SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + branches: [ testing, main ] jobs: sonarqube: @@ -21,44 +13,24 @@ jobs: runs-on: ubuntu-latest container: - image: sonarsource/sonar-scanner-cli:latest + image: sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1 options: --user root steps: - - name: Checkout code + - name: Checkout repository uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Set project metadata + - name: Run Scan run: | - echo "PROJECT_KEY=${{ gitea.repository }}" >> $GITHUB_ENV - echo "PROJECT_NAME=${{ gitea.repository }}" >> $GITHUB_ENV + REPO_NAME=${{ gitea.event.repository.name }} - - name: Run SonarQube Scan - run: | sonar-scanner \ - -Dsonar.projectKey=$PROJECT_KEY \ - -Dsonar.projectName=$PROJECT_NAME \ + -Dsonar.projectKey=$REPO_NAME \ + -Dsonar.projectName=$REPO_NAME \ -Dsonar.sources=. \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} \ + -Dsonar.token=${{ secrets.SONARQUBE_TOKEN }} \ -Dsonar.exclusions=node_modules/**,dist/**,coverage/** \ - -Dsonar.qualitygate.wait=true \ - -Dsonar.branch.name=${{ gitea.ref_name }} - - # PR-specific configuration - - name: SonarQube PR Analysis - if: gitea.event_name == 'pull_request' - run: | - sonar-scanner \ - -Dsonar.projectKey=$PROJECT_KEY \ - -Dsonar.projectName=$PROJECT_NAME \ - -Dsonar.sources=. \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.exclusions=node_modules/**,dist/**,coverage/** \ - -Dsonar.qualitygate.wait=true \ - -Dsonar.pullrequest.key=${{ gitea.event.pull_request.number }} \ - -Dsonar.pullrequest.branch=${{ gitea.head_ref }} \ - -Dsonar.pullrequest.base=${{ gitea.base_ref }} \ No newline at end of file + -Dsonar.qualitygate.wait=true \ No newline at end of file