From d1b9a146e96f6d78402735d2cb14acfb9768fca1 Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Tue, 10 Dec 2024 18:14:19 +0000 Subject: [PATCH] No bash Signed-off-by: Paulo Gomes --- actions/install-slsactl/action.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/actions/install-slsactl/action.yml b/actions/install-slsactl/action.yml index 541c6c3..8410121 100644 --- a/actions/install-slsactl/action.yml +++ b/actions/install-slsactl/action.yml @@ -39,8 +39,8 @@ runs: - name: Install slsactl from gh release if: runner.os == 'Linux' - shell: bash run: | + set -x if [[ "${VERSION}" == "latest" ]]; then echo 'Checking what the latest version is' VERSION=$(curl -s 'https://api.github.com/repos/rancherlabs/slsactl/releases/latest' | jq -r '.tag_name') @@ -79,14 +79,17 @@ runs: curl -LO "https://${REPO}/releases/download/${VERSION}/${FILE}" grep "${FILE}" "slsactl_${VERSION#v}_checksums.txt" | sha256sum -c - chmod +x "${FILE}" - sudo mv "${FILE}" /usr/local/bin/slsactl + chmod +x "${FILE}" + if sudo -l &> /dev/null; then + sudo mv "${FILE}" /usr/local/bin/slsactl + else + mv "${FILE}" /usr/local/bin/slsactl + fi env: VERSION: ${{ inputs.version }} REPO: github.com/rancherlabs/slsactl - name: Print version - shell: bash run: | echo "slsactl installed:" slsactl version