diff --git a/.gitea/workflows/branch-sonarscan-pr-merge.yml b/.gitea/workflows/branch-sonarscan-pr-merge.yml index 294230a5..928c3dd5 100644 --- a/.gitea/workflows/branch-sonarscan-pr-merge.yml +++ b/.gitea/workflows/branch-sonarscan-pr-merge.yml @@ -49,34 +49,45 @@ jobs: }' | jq '{index: .number}' > pr_created.json echo "pr_created=$(jq -c . pr_created.json)" >> "$GITHUB_OUTPUT" - # # Job 2: Run SonarQube Analysis - # sonarqube-analysis: - # runs-on: ubuntu-latest - # needs: check-and-create-pr - # outputs: - # quality_gate_status: ${{ steps.quality-gate.outputs.quality-gate-status }} - # steps: - # - name: Checkout Code - # uses: actions/checkout@v4 + # Job 2: Run SonarQube Analysis + sonarqube-analysis: + runs-on: ubuntu-latest + needs: check-and-create-pr + outputs: + quality_gate_status: ${{ steps.quality-gate.outputs.quality-gate-status }} + steps: + - name: Checkout Code + uses: actions/checkout@v4 - # # Step 1: Run SonarQube Scan - # - name: SonarQube Scan - # uses: sonarsource/sonarqube-scan-action@v4.1.0 - # env: - # SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} - # SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + # Step 1: Run SonarQube Scan + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@v4.1.0 + env: + SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} - # # Step 2: SonarQube Quality Gate Check - # - name: SonarQube Quality Gate - # id: quality-gate - # uses: sonarsource/sonarqube-quality-gate-action@v1 - # env: - # SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} - # SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + # Step 2: SonarQube Quality Gate Check + - name: SonarQube Quality Gate + id: quality-gate + uses: sonarsource/sonarqube-quality-gate-action@v1 + env: + SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + + - name: Pause for quality gate results + run: sleep 10 - # - name: Log Quality Gate Result - # run: | - # echo "Quality Gate Status: ${{ steps.quality-gate.outputs.quality-gate-status }}" + - name: Check Quality Gate Status + uses: DesarrolloORT/sonarqube-quality-gate-action@v1 + id: quality-gate-check + with: + sonar-host-url: ${{ secrets.SONARQUBE_HOST }} + sonar-token: ${{ secrets.SONARQUBE_TOKEN }} + github-token: ${{ secrets.BOT_GITEA_TOKEN }} + + - name: Log Quality Gate Result + run: | + echo "Quality Gate Status: ${{ steps.quality-gate.outputs.quality-gate-status }}" # # Job 3: Merge PR if Quality Gate passes # merge-pr: