Skip to content

Commit

Permalink
add input variable to specify tfsec version to install (#18)
Browse files Browse the repository at this point in the history
* add input variable to specify tfsec version to install

* add description about tfsec_version input
  • Loading branch information
nao23 authored May 24, 2021
1 parent 418993f commit ca46f53
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ See [reviewdog documentation for exit codes](https://github.com/reviewdog/review
Optional. Additional reviewdog flags. Useful for debugging errors, when it can be set to `-tee`.
The default is ``.

### `tfsec_version`

Optional. The version of tfsec to install.
The default is `latest`.

### `tfsec_flags`

Optional. List of arguments to send to tfsec.
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ inputs:
description: 'Additional reviewdog flags'
default: ''
required: false
tfsec_version:
description: |
The version of tfsec to install.
Default is latest.
default: 'latest'
required: false
tfsec_flags:
description: |
List of arguments to send to tfsec
Expand Down Expand Up @@ -73,6 +79,7 @@ runs:
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
INPUT_FLAGS: ${{ inputs.flags }}
INPUT_TFSEC_VERSION: ${{ inputs.tfsec_version }}
INPUT_TFSEC_FLAGS: ${{ inputs.tfsec_flags }}

branding:
Expand Down
9 changes: 7 additions & 2 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ echo "::group::🐶 Installing reviewdog (${REVIEWDOG_VERSION}) ... https://gith
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${REVIEWDOG_PATH}" "${REVIEWDOG_VERSION}" 2>&1
echo '::endgroup::'

echo '::group:: Installing tfsec (latest) ... https://github.com/tfsec/tfsec'
echo "::group:: Installing tfsec (${INPUT_TFSEC_VERSION}) ... https://github.com/tfsec/tfsec"
test ! -d "${TFSEC_PATH}" && install -d "${TFSEC_PATH}"

if [[ "${INPUT_TFSEC_VERSION}" = "latest" ]]; then
tfsec_version=$(curl --silent https://api.github.com/repos/tfsec/tfsec/releases/latest | jq -r .tag_name)
else
tfsec_version=${INPUT_TFSEC_VERSION}
fi
binary="tfsec"
url="https://github.com/tfsec/tfsec/releases/latest/download/tfsec-${os}-${arch}"
url="https://github.com/tfsec/tfsec/releases/download/${tfsec_version}/tfsec-${os}-${arch}"
if [[ "${os}" = "windows" ]]; then
url+=".exe"
binary+=".exe"
Expand Down

0 comments on commit ca46f53

Please sign in to comment.