add action & entrypoint

This commit is contained in:
dw1 2020-01-30 16:35:26 +07:00
parent fcf0075f5e
commit b74f7cb670
2 changed files with 43 additions and 0 deletions

23
action.yaml Normal file
View File

@ -0,0 +1,23 @@
name: 'SonarQube Scan'
description: 'Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages.'
author: 'Dwi Siswanto'
branding:
icon: 'check'
color: 'green'
runs:
using: 'docker'
image: 'Dockerfile'
inputs:
host:
description: 'SonarQube server URL'
required: true
projectBaseDir:
description: 'Set the sonar.projectBaseDir analysis property'
required: false
default: '.'
login:
description: 'Login or authentication token of a SonarQube user'
required: true
password:
description: 'Password that goes with the sonar.login username. This should be left blank if an authentication token is being used.'
required: false

20
entrypoint.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
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}