3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-16 19:27:39 +00:00

Updated error handling

This commit is contained in:
Tonye Jack 2022-10-21 07:02:46 -06:00
parent dd5ec50e4b
commit b670630c81

View file

@ -29,8 +29,20 @@ function get_diff() {
sha="$2"
filter="$3"
while IFS='' read -r sub; do
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')"
sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')"
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')" && exit_status=$? || exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get previous commit for submodule ($sub) between: $base$DIFF$sha"
exit 1
fi
sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')" && exit_status=$? || exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get current commit for submodule ($sub) between: $base$DIFF$sha"
exit 1
fi
if [ -n "$sub_commit_cur" ]; then
(
cd "$sub" && (
@ -62,8 +74,20 @@ function get_renames() {
base="$1"
sha="$2"
while IFS='' read -r sub; do
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')"
sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')"
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')" && exit_status=$? || exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get previous commit for submodule ($sub) between: $base$DIFF$sha"
exit 1
fi
sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')" && exit_status=$? || exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get current commit for submodule ($sub) between: $base$DIFF$sha"
exit 1
fi
if [ -n "$sub_commit_cur" ]; then
(
cd "$sub" && (