From 269ccae30b65cae00efd810d4682e0db9f1493a4 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 12 Feb 2022 16:26:44 -0500 Subject: [PATCH] fix: Error with multiple changed files from merge commits Fixes: #355 --- entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2da047029be..a7a98dd00fa 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -33,7 +33,7 @@ fi echo "Getting HEAD info..." if [[ -z $INPUT_SHA ]]; then - CURRENT_SHA=$(git rev-parse HEAD 2>&1) && exit_status=$? || exit_status=$? + CURRENT_SHA=$(git rev-list --no-merges -n 1 HEAD 2>&1) && exit_status=$? || exit_status=$? else CURRENT_SHA=$INPUT_SHA && exit_status=$? || exit_status=$? fi @@ -52,7 +52,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then CURRENT_BRANCH=$TARGET_BRANCH if [[ -z $INPUT_BASE_SHA ]]; then - PREVIOUS_SHA=$(git rev-parse HEAD^1 2>&1) && exit_status=$? || exit_status=$? + PREVIOUS_SHA=$(git rev-list --no-merges -n 1 HEAD^1 2>&1) && exit_status=$? || exit_status=$? else PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$? TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$? @@ -72,7 +72,7 @@ else if [[ -z $INPUT_BASE_SHA ]]; then git fetch --no-tags -u --progress --depth=1 temp_changed_files "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? - PREVIOUS_SHA=$(git rev-parse "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? + PREVIOUS_SHA=$(git rev-list --no-merges -n 1 "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? else git fetch --no-tags -u --progress --depth=1 temp_changed_files "$INPUT_BASE_SHA" && exit_status=$? || exit_status=$? PREVIOUS_SHA=$INPUT_BASE_SHA