diff --git a/entrypoint.sh b/entrypoint.sh index 9d9f9bf..5661a91 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -45,9 +45,13 @@ _main() { } _check_if_git_is_available() { - PATH_TO_GIT=$(which $INPUT_INTERNAL_GIT_BINARY); - - echo "::debug::Path to git binary ${PATH_TO_GIT}"; + if hash -- "$INPUT_INTERNAL_GIT_BINARY" 2> /dev/null; then + echo "git found"; + echo "::debug::git binary found"; + else + echo "git not found. git-auto-commit requires git to be available." >&2 + exit 1 + fi } _switch_to_repository() { diff --git a/tests/git-auto-commit.bats b/tests/git-auto-commit.bats index f85f653..bbec849 100644 --- a/tests/git-auto-commit.bats +++ b/tests/git-auto-commit.bats @@ -1051,4 +1051,5 @@ cat_github_output() { run git_auto_commit assert_failure; + assert_line "git not found. git-auto-commit requires git to be available." }