Update github action file
This commit is contained in:
parent
bb82eaaa1f
commit
c109893303
|
|
@ -24,9 +24,7 @@ on:
|
|||
- master_openeducat_erp-14.0.1.0
|
||||
- master_odex25_ensan
|
||||
- master_odex25_donation
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
|
||||
jobs:
|
||||
sonar:
|
||||
|
|
@ -34,55 +32,28 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run SonarScanner
|
||||
run: |
|
||||
SONAR_HOST_URL=${{ secrets.SONAR_HOST_URL }}
|
||||
SONAR_TOKEN=${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||
BRANCH_NAME="${GITHUB_HEAD_REF}"
|
||||
BASE_BRANCH="${GITHUB_BASE_REF}"
|
||||
PR_KEY="${{ github.event.pull_request.number }}"
|
||||
|
||||
echo "🔎 Running PR analysis for PR #$PR_KEY ($BRANCH_NAME -> $BASE_BRANCH)"
|
||||
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey="odex25_standard_modules" \
|
||||
-Dsonar.projectName="Odex25 Standard Modules" \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.inclusions="**/*.py,**/*.xml,**/*.js,**/*.html,**/*.css" \
|
||||
-Dsonar.exclusions="**/__manifest__.py,**/migrations/**,**/__pycache__/**" \
|
||||
-Dsonar.sourceEncoding="UTF-8" \
|
||||
-Dsonar.host.url="$SONAR_HOST_URL" \
|
||||
-Dsonar.token="$SONAR_TOKEN" \
|
||||
-Dsonar.pullrequest.key="$PR_KEY" \
|
||||
-Dsonar.pullrequest.branch="$BRANCH_NAME" \
|
||||
-Dsonar.pullrequest.base="$BASE_BRANCH"
|
||||
|
||||
else
|
||||
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
|
||||
SAFE_BRANCH_NAME="${BRANCH_NAME//\//_}"
|
||||
PROJECT_KEY="odex25_standard_modules_${SAFE_BRANCH_NAME}"
|
||||
PROJECT_NAME="Standard Modules ${SAFE_BRANCH_NAME^}"
|
||||
SOURCE_FOLDER_NAME="${BRANCH_NAME#master_}"
|
||||
PROJECT_VERSION="1.0"
|
||||
|
||||
echo "🔎 Running branch analysis for $BRANCH_NAME (Project: $PROJECT_KEY)"
|
||||
export BRANCH_NAME="${GITHUB_REF#refs/heads/}"
|
||||
export SAFE_BRANCH_NAME="${BRANCH_NAME//\//_}"
|
||||
export PROJECT_KEY="odex25_standard_modules_${SAFE_BRANCH_NAME}"
|
||||
export PROJECT_NAME="Standard Modules ${SAFE_BRANCH_NAME^}"
|
||||
export SOURCE_FOLDER_NAME="${BRANCH_NAME#master_}"
|
||||
export PROJECT_VERSION="1.0"
|
||||
export SONAR_HOST_URL=${{ secrets.SONAR_HOST_URL }}
|
||||
export SONAR_TOKEN=${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey="$PROJECT_KEY" \
|
||||
-Dsonar.projectName="$PROJECT_NAME" \
|
||||
-Dsonar.projectVersion="$PROJECT_VERSION" \
|
||||
-Dsonar.sources="$SOURCE_FOLDER_NAME" \
|
||||
-Dsonar.inclusions="**/*.py,**/*.xml,**/*.js,**/*.html,**/*.css" \
|
||||
-Dsonar.exclusions="**/__manifest__.py,**/migrations/**,**/__pycache__/**" \
|
||||
-Dsonar.inclusions="**/*.py, **/*.xml, **/*.js, **/*.html, **/*.css" \
|
||||
-Dsonar.exclusions="**/__manifest__.py, **/migrations/**, **/__pycache__/**" \
|
||||
-Dsonar.sourceEncoding="UTF-8" \
|
||||
-Dsonar.host.url="$SONAR_HOST_URL" \
|
||||
-Dsonar.token="$SONAR_TOKEN"
|
||||
fi
|
||||
-Dsonar.login="$SONAR_TOKEN"
|
||||
|
||||
- name: Cleanup workspace
|
||||
if: always()
|
||||
|
|
|
|||
Loading…
Reference in New Issue