From 9a32252000423e319fbc53625934345bb6c41921 Mon Sep 17 00:00:00 2001 From: jw-maynard Date: Sat, 29 Oct 2022 16:40:54 -0700 Subject: [PATCH] Add tflint Target Directory Parameter (#59) * Add a tflint_target_dir optional variable * Use INPUT_TFLINT_TARGET_DIR in tflint command --- action.yml | 6 ++++++ script.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1b9693f..a5be4ae 100644 --- a/action.yml +++ b/action.yml @@ -45,6 +45,11 @@ inputs: Whether or not to run tflint --init prior to running scan [true,false] Default is `false`. default: 'false' + tflint_target_dir: + description: | + 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: '.' flags: description: | List of arguments to send to tflint @@ -81,6 +86,7 @@ runs: INPUT_TFLINT_VERSION: ${{ inputs.tflint_version }} INPUT_TFLINT_RULESETS: ${{ inputs.tflint_rulesets }} INPUT_TFLINT_INIT: ${{ inputs.tflint_init }} + INPUT_TFLINT_TARGET_DIR: ${{ inputs.tflint_target_dir }} INPUT_FLAGS: ${{ inputs.flags }} branding: diff --git a/script.sh b/script.sh index 97918de..90cf848 100755 --- a/script.sh +++ b/script.sh @@ -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} . \ + TFLINT_PLUGIN_DIR=${TFLINT_PLUGIN_DIR} "${TFLINT_PATH}/tflint" --format=checkstyle ${INPUT_FLAGS} ${INPUT_TFLINT_TARGET_DIR} \ | "${REVIEWDOG_PATH}/reviewdog" -f=checkstyle \ -name="tflint" \ -reporter="${INPUT_REPORTER}" \