From accc3466551354ae1318e8a29a414283125ab339 Mon Sep 17 00:00:00 2001 From: Dariusz Dwornikowski Date: Sat, 11 Jul 2020 13:06:03 +0200 Subject: [PATCH] Add setting of projectName --- README.md | 1 + action.yaml | 4 ++++ entrypoint.sh | 3 +++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index e897d4a..c952cb6 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ uses: kitabisa/sonarqube-action@master with: projectBaseDir: my-custom-directory projectKey: my-custom-project + projectName: "my-project-name" ``` ## Secrets diff --git a/action.yaml b/action.yaml index 411651c..5e44bae 100644 --- a/action.yaml +++ b/action.yaml @@ -15,6 +15,10 @@ inputs: description: "The project's unique key. Allowed characters are: letters, numbers, -, _, . and :, with at least one non-digit." required: false default: "" + projectName: + description: "The project's name. If not given name will be generated by SonarQube" + required: false + default: "" projectBaseDir: description: "Set the sonar.projectBaseDir analysis property" required: false diff --git a/entrypoint.sh b/entrypoint.sh index 5977021..a38febe 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,10 +12,13 @@ fi [[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD="" [[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}" +[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTNAME}" + sonar-scanner \ -Dsonar.host.url=${INPUT_HOST} \ -Dsonar.projectKey=${SONAR_PROJECTKEY} \ + -Dsonar.projectName=${SONAR_PROJECTNAME} \ -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \ -Dsonar.login=${INPUT_LOGIN} \ -Dsonar.password=${INPUT_PASSWORD} \