mirror of
https://github.com/sonarsource/sonarcloud-github-action.git
synced 2026-06-06 16:47:12 +00:00
24 lines
788 B
Bash
Executable file
24 lines
788 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if [[ -z "${SONAR_TOKEN}" ]]; then
|
|
echo "Set the SONAR_TOKEN 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" || -f "${INPUT_PROJECTBASEDIR%/}/build.gradle.kts" ]]; then
|
|
echo "Gradle project detected. You should use the SonarQube plugin for Gradle during build rather than using this GitHub Action."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "${SONARCLOUD_URL}" ]]; then
|
|
SONARCLOUD_URL="https://sonarcloud.io"
|
|
fi
|
|
unset JAVA_HOME
|
|
sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} -Dsonar.host.url=${SONARCLOUD_URL} ${INPUT_ARGS}
|