1 Commits

Author SHA1 Message Date
Dwi Siswanto
73c272d7a5 Removes a constant value that will rewrite values of properties 2020-07-21 23:20:39 +07:00
3 changed files with 21 additions and 32 deletions

View File

@@ -1,24 +1,22 @@
FROM sonarsource/sonar-scanner-cli:4 FROM newtmitch/sonar-scanner:4.0.0-alpine
LABEL "com.github.actions.name"="SonarQube Scan" LABEL "com.github.actions.name"="SonarQube Scan"
LABEL "com.github.actions.description"="Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages." LABEL "com.github.actions.description"="Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages."
LABEL "com.github.actions.icon"="check" LABEL "com.github.actions.icon"="check"
LABEL "com.github.actions.color"="green" LABEL "com.github.actions.color"="green"
LABEL version="0.0.2" LABEL version="0.0.1"
LABEL repository="https://github.com/kitabisa/sonarqube-action" LABEL repository="https://github.com/kitabisa/sonarqube-action"
LABEL homepage="https://kitabisa.github.io" LABEL homepage="https://kitabisa.github.io"
LABEL maintainer="dwisiswant0" LABEL maintainer="dwisiswant0"
RUN npm config set unsafe-perm true && \ RUN npm config set unsafe-perm true && \
npm install --silent --save-dev -g typescript@3.5.2 && \ npm install --silent --save-dev -g typescript@3.5.2 && \
npm config set unsafe-perm false && \ npm config set unsafe-perm false
apk add --no-cache ca-certificates jq
ENV NODE_PATH "/usr/lib/node_modules/" ENV NODE_PATH "/usr/lib/node_modules/"
RUN apk add --no-cache ca-certificates jq
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -24,7 +24,7 @@ jobs:
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- name: SonarQube Scan - name: SonarQube Scan
uses: kitabisa/sonarqube-action@v1.1.0 uses: kitabisa/sonarqube-action@master
with: with:
host: ${{ secrets.SONARQUBE_HOST }} host: ${{ secrets.SONARQUBE_HOST }}
login: ${{ secrets.SONARQUBE_TOKEN }} login: ${{ secrets.SONARQUBE_TOKEN }}

View File

@@ -6,32 +6,23 @@ if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
EVENT_ACTION=$(jq -r ".action" "${GITHUB_EVENT_PATH}") EVENT_ACTION=$(jq -r ".action" "${GITHUB_EVENT_PATH}")
if [[ "${EVENT_ACTION}" != "opened" ]]; then if [[ "${EVENT_ACTION}" != "opened" ]]; then
echo "No need to run analysis. It is already triggered by the push event." echo "No need to run analysis. It is already triggered by the push event."
exit exit 78
fi fi
fi fi
REPOSITORY_NAME=$(basename "${GITHUB_REPOSITORY}")
[[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD="" [[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD=""
[[ ! -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${INPUT_PROJECTKEY}" || SONAR_PROJECTKEY=""
[[ ! -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${INPUT_PROJECTNAME}" || SONAR_PROJECTNAME=""
[[ ! -z ${INPUT_PROJECTVERSION} ]] && SONAR_PROJECTVERSION="${INPUT_PROJECTVERSION}" || SONAR_PROJECTVERSION=""
if [[ ! -f "${GITHUB_WORKSPACE}/sonar-project.properties" ]]; then
[[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${REPOSITORY_NAME}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}" sonar-scanner \
[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${REPOSITORY_NAME}" || SONAR_PROJECTNAME="${INPUT_PROJECTNAME}" -Dsonar.host.url=${INPUT_HOST} \
[[ -z ${INPUT_PROJECTVERSION} ]] && SONAR_PROJECTVERSION="" || SONAR_PROJECTVERSION="${INPUT_PROJECTVERSION}" -Dsonar.projectKey=${SONAR_PROJECTKEY} \
sonar-scanner \ -Dsonar.projectName=${SONAR_PROJECTNAME} \
-Dsonar.host.url=${INPUT_HOST} \ -Dsonar.projectVersion=${SONAR_PROJECTVERSION} \
-Dsonar.projectKey=${SONAR_PROJECTKEY} \ -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \
-Dsonar.projectName=${SONAR_PROJECTNAME} \ -Dsonar.login=${INPUT_LOGIN} \
-Dsonar.projectVersion=${SONAR_PROJECTVERSION} \ -Dsonar.password=${INPUT_PASSWORD} \
-Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \ -Dsonar.sources=. \
-Dsonar.login=${INPUT_LOGIN} \ -Dsonar.sourceEncoding=UTF-8
-Dsonar.password=${SONAR_PASSWORD} \
-Dsonar.sources=. \
-Dsonar.sourceEncoding=UTF-8
else
sonar-scanner \
-Dsonar.host.url=${INPUT_HOST} \
-Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \
-Dsonar.login=${INPUT_LOGIN} \
-Dsonar.password=${SONAR_PASSWORD}
fi