Update .gitea/workflows/sonarscan.yml
All checks were successful
SonarQube Analysis / SonarQube Scan (push) Successful in 1m38s
All checks were successful
SonarQube Analysis / SonarQube Scan (push) Successful in 1m38s
This commit is contained in:
@@ -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 }}
|
||||
-Dsonar.qualitygate.wait=true
|
||||
Reference in New Issue
Block a user