-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathentrypoint.sh
executable file
·35 lines (28 loc) · 973 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -e
CHANGED_FILES=()
for path in ${INPUT_FILES}
do
echo "Checking for file changes: \"${path}\"..."
# shellcheck disable=SC2207
CHANGED_FILES+=($(git diff --diff-filter=ACMUXTR --name-only | grep -E "(${path})" || true))
# Find unstaged changes
# shellcheck disable=SC2207
CHANGED_FILES+=($(git status --porcelain | awk '{ print $2 }' | grep -E "(${path})" || true))
done
IFS=" " read -r -a UNIQUE_CHANGED_FILES <<< "$(echo "${CHANGED_FILES[@]}" | tr " " "\n" | sort -u | tr "\n" " ")"
if [[ -n "${UNIQUE_CHANGED_FILES[*]}" ]]; then
echo "Found uncommited changes"
echo "---------------"
printf '%s\n' "${UNIQUE_CHANGED_FILES[@]}"
echo "---------------"
else
echo "No changes found."
fi
if [[ -z "${UNIQUE_CHANGED_FILES[*]}" ]]; then
echo "::set-output name=files_changed::false"
else
echo "::set-output name=files_changed::true"
echo "::set-output name=changed_files::${UNIQUE_CHANGED_FILES[*]}"
fi
exit 0;