Skip to content

Commit

Permalink
Add parameter tflint_config (#68)
Browse files Browse the repository at this point in the history
* implement input tflint_config

* prevent globbing and word splitting

* prevent globbing and word splitting

* prevent globbing and word splitting

---------

Co-authored-by: ICHINOSE Shogo <shogo82148@gmail.com>
  • Loading branch information
thaim and shogo82148 committed Apr 28, 2023
1 parent 397c1cd commit 3bbbd23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ inputs:
The target dir for the tflint command. This is the directory passed to tflint as opposed to working_directory which is the directory the command is executed from.
Default is . ( root of the repository)
default: '.'
tflint_config:
description: |
Config file name for tflint.
Default is `.tflint.hcl`.
default: '.tflint.hcl'
flags:
description: |
List of arguments to send to tflint
Expand Down Expand Up @@ -87,6 +92,7 @@ runs:
INPUT_TFLINT_RULESETS: ${{ inputs.tflint_rulesets }}
INPUT_TFLINT_INIT: ${{ inputs.tflint_init }}
INPUT_TFLINT_TARGET_DIR: ${{ inputs.tflint_target_dir }}
INPUT_TFLINT_CONFIG: ${{ inputs.tflint_config }}
INPUT_FLAGS: ${{ inputs.flags }}

branding:
Expand Down
6 changes: 3 additions & 3 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ done
case "${INPUT_TFLINT_INIT:-false}" in
true)
echo "::group:: Initialize tflint from local configuration"
TFLINT_PLUGIN_DIR="${TFLINT_PLUGIN_DIR}" GITHUB_TOKEN="${INPUT_GITHUB_TOKEN}" "${TFLINT_PATH}/tflint" --init
TFLINT_PLUGIN_DIR="${TFLINT_PLUGIN_DIR}" GITHUB_TOKEN="${INPUT_GITHUB_TOKEN}" "${TFLINT_PATH}/tflint" --init -c "${INPUT_TFLINT_CONFIG}"
echo "::endgroup::"
;;
false)
Expand All @@ -87,7 +87,7 @@ case "${INPUT_TFLINT_INIT:-false}" in
esac

echo "::group:: Print tflint details ..."
"${TFLINT_PATH}/tflint" --version
"${TFLINT_PATH}/tflint" --version -c "${INPUT_TFLINT_CONFIG}"
echo '::endgroup::'


Expand All @@ -98,7 +98,7 @@ echo '::group:: Running tflint with reviewdog 🐶 ...'
set +Eeuo pipefail

# shellcheck disable=SC2086
TFLINT_PLUGIN_DIR=${TFLINT_PLUGIN_DIR} "${TFLINT_PATH}/tflint" --format=checkstyle ${INPUT_FLAGS} ${INPUT_TFLINT_TARGET_DIR} \
TFLINT_PLUGIN_DIR=${TFLINT_PLUGIN_DIR} "${TFLINT_PATH}/tflint" -c "${INPUT_TFLINT_CONFIG}" --format=checkstyle ${INPUT_FLAGS} ${INPUT_TFLINT_TARGET_DIR} \
| "${REVIEWDOG_PATH}/reviewdog" -f=checkstyle \
-name="tflint" \
-reporter="${INPUT_REPORTER}" \
Expand Down

0 comments on commit 3bbbd23

Please sign in to comment.