From a59f7b5b7ef3161fc70b722b8838f079f787266a Mon Sep 17 00:00:00 2001 From: John Watson Date: Wed, 30 Aug 2023 18:19:01 -0700 Subject: [PATCH] Support passing multiple patterns through file_pattern --- entrypoint.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f655121..4d43fc2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,14 +7,13 @@ COMMIT_MESSAGE="${1:?Missing commit_message input}" REPO="${2:?Missing repo input}" BRANCH="${3:?Missing branch input}" EMPTY="${4:-false}" -FILE_PATTERN="${5:?Missing file_pattern input}" +read -r -a FILE_PATTERNS <<<"${5:?Missing file_pattern input}" git config --global --add safe.directory "$GITHUB_WORKSPACE" adds=() deletes=() -# shellcheck disable=SC2086 while IFS= read -r -d $'\0' line; do [[ -n "${DEBUG:-}" ]] && echo "line: '$line'" @@ -54,7 +53,7 @@ while IFS= read -r -d $'\0' line; do # handle deletes (D): [[ "$tree_status" =~ D || "$index_status" =~ D ]] && deletes+=("$filename") -done < <(git status -s --porcelain=v1 -z -- $FILE_PATTERN) +done < <(git status -s --porcelain=v1 -z -- "${FILE_PATTERNS[@]}") if [[ "${#adds[@]}" -eq 0 && "${#deletes[@]}" -eq 0 && "$EMPTY" == "false" ]]; then echo "No changes detected, exiting"