mirror of
https://github.com/kitabisa/sonarqube-action.git
synced 2025-11-02 06:14:19 +08:00
29 lines
659 B
Bash
29 lines
659 B
Bash
#!/bin/bash
|
|
|
|
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 78
|
|
fi
|
|
fi
|
|
|
|
if [[ -z "${INPUT_PASSWORD}" ]]; then
|
|
SONAR_PASSWORD="&& true"
|
|
else
|
|
SONAR_PASSWORD="${INPUT_PASSWORD}"
|
|
fi
|
|
|
|
sonar-scanner \
|
|
-Dsonar.host.url=${INPUT_HOST} \
|
|
-Dsonar.projectKey=${PWD##*/} \
|
|
-Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \
|
|
-Dsonar.login=${INPUT_LOGIN} \
|
|
-Dsonar.password=${INPUT_PASSWORD} \
|
|
-Dsonar.sources=. \
|
|
-Dsonar.sourceEncoding=UTF-8 \
|
|
${SONAR_PASSWORD}
|
|
|