Skip to content

Commit

Permalink
#11 Issue with stashing changes when the stash is empty (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
nimshi89 authored Jun 12, 2023
1 parent b73d40d commit 8658dee
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions process-deleted-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ deleted_files+=(${excluded_files[@]})
mapfile -t deleted_files < <(printf "%s\n" "${deleted_files[@]}" | sort)

function delete_csvw_outputs {
echo "has_outputs=true" >> $GITHUB_OUTPUT

local csv_file="$1"
local out_path=$(get_out_path "$csv_file")
Expand All @@ -45,12 +44,18 @@ function delete_csvw_outputs {
fi

git stash

# Go back to the original branch/tag we were working on.
git checkout "$GITHUB_REF_NAME"

# Reapply the changes we stashed from the "$GITHUB_REF_NAME" tag/branch.
git stash apply stash@{1}

local stash_content=$(git stash list)

if [[ -n "$stash_content" ]]; then # Reapply the changes we stashed from the "$GITHUB_REF_NAME" tag/branch.
git stash apply stash@{1}
echo "has_outputs=true" >> $GITHUB_OUTPUT
else
echo "stash was empty."
fi
fi
}

Expand Down Expand Up @@ -83,4 +88,4 @@ for file in "${deleted_files[@]}"; do
fi

echo "---Finished Handling Deletions for File: ${file}"
done
done

0 comments on commit 8658dee

Please sign in to comment.