diff --git a/action.yml b/action.yml index 7e392c5..1ebe310 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,9 @@ inputs: version: description: "Speficic terraform-compliance version to be used." required: false + installed_path: + description: "In case you are running a custom runner, this is the path where terraform-compliance executable is installed." + required: false outputs: result: @@ -33,7 +36,8 @@ outputs: runs: using: "composite" steps: - - run: ${{ github.action_path }}/install.sh "${{ inputs.version }}" "${{ inputs.install_terraform }}" "${{ inputs.terraform_version }}" + - id: install + run: ${{ github.action_path }}/install.sh "${{ inputs.version }}" "${{ inputs.installed_path }}" shell: bash - id: run run: ${{ github.action_path }}/run.sh "${{ inputs.plan }}" "${{ inputs.features }}" "${{ inputs.quit-early }}" "${{ inputs.no-failure}}" "${{ inputs.silent }}" "${{ inputs.identity }}" "${{ inputs.execute }}" diff --git a/install.sh b/install.sh index 72d0700..bc5a651 100755 --- a/install.sh +++ b/install.sh @@ -7,6 +7,11 @@ if [[ -n $1 ]]; then v=$1 fi +INSTALLED_PATH="/home/runner/.local/bin/terraform-compliance" +if [[ -n $2 ]]; then + INSTALLED_PATH=$2 +fi + # Required for installing terraform-compliance... echo "Installing required packages for terraform-compliance" sudo apt-get install -y -qq python3-setuptools python3-wheel > /dev/null @@ -15,6 +20,7 @@ sudo apt-get install -y -qq python3-setuptools python3-wheel > /dev/null echo "Installing terraform-compliance$VERSION version $v" pip3 install -q wheel terraform-compliance$VERSION + if [ ! -f /usr/local/bin/terraform-compliance ]; then - sudo ln -s /home/runner/.local/bin/terraform-compliance /usr/local/bin + sudo ln -s "$INSTALLED_PATH" /usr/local/bin fi diff --git a/run.sh b/run.sh index 827e12e..73ace3b 100755 --- a/run.sh +++ b/run.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -PARAMETERS="/home/runner/.local/bin/terraform-compliance" +PARAMETERS="/usr/local/bin/terraform-compliance" if [[ -n $1 ]]; then PLAN_FILE="$GITHUB_WORKSPACE/$1"