👷 ci(build): simplify sonar project key retrieval
Some checks failed
build-and-push / lint (push) Successful in 4s
build-and-push / sonar (push) Failing after 6s
build-and-push / docker (push) Has been skipped

- remove redundant conditional logic for project key extraction
- enforce mandatory SONAR_PROJECT_KEY secret for consistency
- change sonar.scm.provider to 'none' for improved configuration
This commit is contained in:
nocci 2025-12-30 13:02:52 +00:00
parent e11d40bdda
commit 608b6b87cd

View file

@ -35,11 +35,7 @@ jobs:
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
run: |
HOST_URL=${SONAR_HOST_URL:?SONAR_HOST_URL secret not set}
PROJECT_KEY="${SONAR_PROJECT_KEY}"
if [ -z "$PROJECT_KEY" ] && [ -f sonar-project.properties ]; then
PROJECT_KEY=$(grep -E '^sonar.projectKey=' sonar-project.properties | cut -d= -f2 | tr -d '\r')
fi
PROJECT_KEY=${PROJECT_KEY:-free-games-claimer}
PROJECT_KEY=${SONAR_PROJECT_KEY:?SONAR_PROJECT_KEY secret not set}
docker run --rm \
-e SONAR_HOST_URL="$HOST_URL" \
-e SONAR_TOKEN="$SONAR_TOKEN" \
@ -49,9 +45,9 @@ jobs:
sonar-scanner \
-Dsonar.host.url="$HOST_URL" \
-Dsonar.token="$SONAR_TOKEN" \
-Dsonar.projectKey="${PROJECT_KEY:-free-games-claimer}" \
-Dsonar.projectKey="$PROJECT_KEY" \
-Dsonar.sources=. \
-Dsonar.scm.provider=git \
-Dsonar.scm.provider=none \
-Dsonar.projectBaseDir=/usr/src
docker: