Let Action fail if git binary can't be located (#261)

* Check if git binary exists

* Add Tests
This commit is contained in:
Stefan Zweifel
2022-11-05 11:53:46 +01:00
committed by GitHub
parent 7106b2184a
commit 0b007fbd11
3 changed files with 25 additions and 0 deletions

View File

@@ -7,6 +7,8 @@ if "$INPUT_DISABLE_GLOBBING"; then
fi
_main() {
_check_if_git_is_available
_switch_to_repository
if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then
@@ -42,6 +44,14 @@ _main() {
fi
}
_check_if_git_is_available() {
if hash -- "$INPUT_INTERNAL_GIT_BINARY" 2> /dev/null; then
echo "::debug::git binary found.";
else
echo "::error ::git-auto-commit could not find git binary. Please make sure git is available."
exit 1;
fi
}
_switch_to_repository() {
echo "INPUT_REPOSITORY value: $INPUT_REPOSITORY";