From 39e57273ed8f513872326b228217828be6a42730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstro=CC=88m?= Date: Mon, 5 Feb 2024 07:08:52 -0300 Subject: [PATCH] fix: use sudo to move binary to `/usr/local/bin` For self-hosted runners we need sudo for write permissions to `/usr/local/bin`. PR: https://github.com/jbergstroem/hadolint-gh-action/pull/145 Closes: https://github.com/jbergstroem/hadolint-gh-action/issues/144 --- install.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 6e94dee..48523f7 100755 --- a/install.sh +++ b/install.sh @@ -27,13 +27,15 @@ fi # Download hadolint if necessary if [ "${DOWNLOAD}" == "true" ]; then echo "::debug::Downloading Hadolint ${VERSION}" - # https://github.com/actions/runner-images/issues/3727 - # /usr/local/bin exists and is writable by any user curl -s -L --fail -w 1 -o /tmp/hadolint \ "https://github.com/hadolint/hadolint/releases/download/v${VERSION}/hadolint-Linux-x86_64" || (echo "::error::Hadolint (version: ${VERSION}) could not be found. Exiting." && exit 1) - mv /tmp/hadolint /usr/local/bin/hadolint - chmod +x /usr/local/bin/hadolint + chmod +x /tmp/hadolint + # https://github.com/actions/runner-images/issues/3727 + # /usr/local/bin exists and is writable by any user + # but some self hosted runners requires superpowers to write there + # https://github.com/jbergstroem/hadolint-gh-action/issues/144 + sudo mv /tmp/hadolint /usr/local/bin/hadolint fi new_version=$(eval "${EXTRACT_VERSION_CMD}" 2>&1)