SONAR-14822 Provide a GitHub Action to scan a project
This commit is contained in:
committed by
Wouter Admiraal
parent
1ef5bf722a
commit
71de302835
27
entrypoint.sh
Executable file
27
entrypoint.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -z "${SONAR_TOKEN}" ]]; then
|
||||
echo "This GitHub Action requires the SONAR_TOKEN env variable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${SONAR_HOST_URL}" ]]; then
|
||||
echo "This GitHub Action requires the SONAR_HOST_URL env variable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "${INPUT_PROJECTBASEDIR%/}pom.xml" ]]; then
|
||||
echo "Maven project detected. You should run the goal 'org.sonarsource.scanner.maven:sonar' during build rather than using this GitHub Action."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "${INPUT_PROJECTBASEDIR%/}build.gradle" ]]; then
|
||||
echo "Gradle project detected. You should use the SonarQube plugin for Gradle during build rather than using this GitHub Action."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset JAVA_HOME
|
||||
|
||||
sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS}
|
||||
Reference in New Issue
Block a user