mirror of
https://github.com/tj-actions/changed-files
synced 2024-12-17 13:47:20 +00:00
feat: add support for excluding the top level directory
This commit is contained in:
parent
dddfbd694c
commit
1982157b6c
2 changed files with 9 additions and 0 deletions
|
@ -75,6 +75,10 @@ inputs:
|
|||
dir_names_max_depth:
|
||||
description: "Maximum depth of directories to output. e.g `test/test1/test2` with max depth of `2` returns `test/test1`."
|
||||
required: false
|
||||
dir_names_exclude_root:
|
||||
description: "Exclude the root directory from the output. **NOTE:** This would exclude `.` from the output."
|
||||
required: false
|
||||
default: "false"
|
||||
json:
|
||||
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
|
||||
required: false
|
||||
|
@ -245,6 +249,7 @@ runs:
|
|||
INPUT_DIFF_RELATIVE: ${{ inputs.diff_relative }}
|
||||
INPUT_DIR_NAMES: ${{ inputs.dir_names }}
|
||||
INPUT_DIR_NAMES_MAX_DEPTH: ${{ inputs.dir_names_max_depth }}
|
||||
INPUT_DIR_NAMES_EXCLUDE_ROOT: ${{ inputs.dir_names_exclude_root }}
|
||||
INPUT_JSON: ${{ inputs.json }}
|
||||
INPUT_HAS_CUSTOM_PATTERNS: ${{ steps.glob.outputs.has-custom-patterns }}
|
||||
INPUT_JSON_RAW_FORMAT: ${{ inputs.json_raw_format }}
|
||||
|
|
|
@ -47,6 +47,10 @@ function get_dirname_max_depth() {
|
|||
depth=$((depth + 1))
|
||||
done
|
||||
|
||||
if [[ "$INPUT_DIR_NAMES_EXCLUDE_ROOT" == "true" && "$output" == "." ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$output"
|
||||
done < <(uniq)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue