From cddfe08b9c39f68bac6c3ab5ad13c17f49123b6e Mon Sep 17 00:00:00 2001 From: Cody Simms Date: Thu, 7 Dec 2023 15:53:38 -0600 Subject: [PATCH] Fix permissions of .scannerwork directory --- Dockerfile | 6 +++--- action.yml | 2 ++ cleanup.sh | 9 +++++++++ entrypoint.sh | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 cleanup.sh diff --git a/Dockerfile b/Dockerfile index ac2bf45..7f0d45f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,10 +19,10 @@ ENV LC_ALL="C.UTF-8" WORKDIR /opt -# https://help.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user -USER root - # Prepare entrypoint COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh +COPY cleanup.sh /cleanup.sh +RUN chmod +x /cleanup.sh ENTRYPOINT ["/entrypoint.sh"] + diff --git a/action.yml b/action.yml index 2564e59..de11390 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,8 @@ branding: runs: using: docker image: Dockerfile + entrypoint: "/entrypoint.sh" + post-entrypoint: "/cleanup.sh" inputs: args: description: Additional arguments to the sonarcloud scanner diff --git a/cleanup.sh b/cleanup.sh new file mode 100644 index 0000000..2c20c8b --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +_tmp_file=$(ls "${INPUT_PROJECTBASEDIR}/" | head -1) +PERM=$(stat -c "%u:%g" "${INPUT_PROJECTBASEDIR}/$_tmp_file") + +chown -R $PERM "${INPUT_PROJECTBASEDIR}/" + diff --git a/entrypoint.sh b/entrypoint.sh index d6922f4..2f49958 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,3 +22,4 @@ if [[ -z "${SONARCLOUD_URL}" ]]; then fi unset JAVA_HOME sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} -Dsonar.host.url=${SONARCLOUD_URL} ${INPUT_ARGS} +