diff --git a/action.yml b/action.yml index a5be4ae..a7da69c 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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: diff --git a/script.sh b/script.sh index 931f748..bc31a9e 100755 --- a/script.sh +++ b/script.sh @@ -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) @@ -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::' @@ -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}" \