From 467d26c8b77612d9f7d20df5271edc207eae69a7 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Fri, 19 Nov 2021 16:27:56 -0500 Subject: [PATCH] Updated git fetch to pull the last remote commit (#254) * Update entrypoint.sh * Update entrypoint.sh * Update entrypoint.sh * Update entrypoint.sh * Update entrypoint.sh * Update entrypoint.sh --- entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index b7f6f536..59e700af 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -62,15 +62,18 @@ if [[ -z $GITHUB_BASE_REF ]]; then else TARGET_BRANCH=$GITHUB_BASE_REF CURRENT_BRANCH=$GITHUB_HEAD_REF - git fetch temp_changed_files --no-tags -u "${TARGET_BRANCH}":"${TARGET_BRANCH}" + if [[ -z $INPUT_BASE_SHA ]]; then + git fetch --no-tags -u --progress --depth=1 temp_changed_files "${TARGET_BRANCH}":"${TARGET_BRANCH}" PREVIOUS_SHA=$(git rev-parse "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? else + git fetch --no-tags -u --progress --depth=1 temp_changed_files "$INPUT_BASE_SHA" PREVIOUS_SHA=$INPUT_BASE_SHA fi if [[ $exit_status -ne 0 ]]; then echo "::warning::Unable to determine the base ref sha for ${TARGET_BRANCH}" + echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage" git remote remove temp_changed_files exit 1 fi