mirror of
https://github.com/kitabisa/sonarqube-action.git
synced 2025-11-01 13:44:19 +08:00
update(entrypoint): remove conditional trigger event & dynamic source encoding
and code-style
This commit is contained in:
parent
70d39d8c86
commit
214c4b604a
@ -2,17 +2,9 @@
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
|
||||
EVENT_ACTION=$(jq -r ".action" "${GITHUB_EVENT_PATH}")
|
||||
if [[ "${EVENT_ACTION}" != "opened" ]]; then
|
||||
echo "No need to run analysis. It is already triggered by the push event."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
REPOSITORY_NAME=$(basename "${GITHUB_REPOSITORY}")
|
||||
|
||||
if [[ ! -z ${INPUT_PASSWORD} ]]; then
|
||||
if [[ ! -z "${INPUT_PASSWORD}" ]]; then
|
||||
echo "::warning ::Running this GitHub Action without authentication token is NOT recommended!"
|
||||
SONAR_PASSWORD="${INPUT_PASSWORD}"
|
||||
else
|
||||
@ -32,9 +24,9 @@ fi
|
||||
unset JAVA_HOME
|
||||
|
||||
if [[ ! -f "${INPUT_PROJECTBASEDIR%/}sonar-project.properties" ]]; then
|
||||
[[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${REPOSITORY_NAME}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}"
|
||||
[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${REPOSITORY_NAME}" || SONAR_PROJECTNAME="${INPUT_PROJECTNAME}"
|
||||
[[ -z ${INPUT_PROJECTVERSION} ]] && SONAR_PROJECTVERSION="" || SONAR_PROJECTVERSION="${INPUT_PROJECTVERSION}"
|
||||
[[ -z "${INPUT_PROJECTKEY}" ]] && SONAR_PROJECTKEY="${REPOSITORY_NAME}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}"
|
||||
[[ -z "${INPUT_PROJECTNAME}" ]] && SONAR_PROJECTNAME="${REPOSITORY_NAME}" || SONAR_PROJECTNAME="${INPUT_PROJECTNAME}"
|
||||
[[ -z "${INPUT_PROJECTVERSION}" ]] && SONAR_PROJECTVERSION="" || SONAR_PROJECTVERSION="${INPUT_PROJECTVERSION}"
|
||||
sonar-scanner \
|
||||
-Dsonar.host.url=${INPUT_HOST} \
|
||||
-Dsonar.projectKey=${SONAR_PROJECTKEY} \
|
||||
@ -44,7 +36,7 @@ if [[ ! -f "${INPUT_PROJECTBASEDIR%/}sonar-project.properties" ]]; then
|
||||
-Dsonar.login=${INPUT_LOGIN} \
|
||||
-Dsonar.password=${SONAR_PASSWORD} \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.sourceEncoding=UTF-8
|
||||
-Dsonar.sourceEncoding=${INPUT_ENCODING}
|
||||
else
|
||||
sonar-scanner \
|
||||
-Dsonar.host.url=${INPUT_HOST} \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user