Skip to content

Commit

Permalink
Support passing multiple patterns through file_pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
dctrwatson committed Aug 31, 2023
1 parent 388d54c commit a59f7b5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'"

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit a59f7b5

Please sign in to comment.