From 9bea6a46af788d59fc88f335fd752da4860b10cc Mon Sep 17 00:00:00 2001 From: istvan-bodo-sonarsource Date: Tue, 21 May 2024 14:11:19 +0200 Subject: [PATCH] SQSCANGHA-27 Use GHA debug logging with scanner --- .github/workflows/qa.yml | 18 ++++++++++++++++++ entrypoint.sh | 7 ++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 70d3a00..f4a7be3 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -134,3 +134,21 @@ jobs: - name: Assert run: | ./test/assertFileExists ./test/example-project/.scannerwork/report-task.txt + runnerDebugUsedTest: + name: > + 'RUNNER_DEBUG' is used + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Run action with debug mode + uses: ./ + with: + args: -Dsonar.scanner.dumpToFile=./output.properties + env: + RUNNER_DEBUG: 1 + SONAR_HOST_URL: http://not_actually_used + - name: Assert + run: | + ./test/assertFileContains ./output.properties "sonar.verbose=true" diff --git a/entrypoint.sh b/entrypoint.sh index d0b4e1e..0d0ef25 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,7 +30,12 @@ if [[ -f "${INPUT_PROJECTBASEDIR%/}/build.gradle" ]]; then exit 1 fi +debug_flag='' +if [[ "$RUNNER_DEBUG" == '1' ]]; then + debug_flag='--debug' +fi + unset JAVA_HOME -sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS} +sonar-scanner $debug_flag -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS}