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