From 15b1769fc52da64fe168a41ccb01c48b27687149 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 9 Jun 2021 18:11:27 -0400 Subject: [PATCH] Clean up debug message (#93) * Clean up debug message * Update entrypoint.sh --- entrypoint.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6767412e..75b9cada 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,21 +12,31 @@ else CURR_SHA=$GITHUB_SHA fi +if [[ $exit_status -ne 0 ]]; then + echo "::warning::Unable to determine the current head sha" + exit 1 +fi + if [[ -z $GITHUB_BASE_REF ]]; then PREV_SHA=$(git rev-parse HEAD^1 2>&1) && exit_status=$? || exit_status=$? + + if [[ $exit_status -ne 0 ]]; then + echo "::warning::Unable to determine the previous commit sha" + echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage" + exit 1 + fi else TARGET_BRANCH=${GITHUB_BASE_REF} git fetch --depth=1 origin "${TARGET_BRANCH}":"${TARGET_BRANCH}" PREV_SHA=$(git rev-parse "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? + + if [[ $exit_status -ne 0 ]]; then + echo "::warning::Unable to determine the base ref sha for ${TARGET_BRANCH}" + exit 1 + fi fi -if [[ $exit_status -ne 0 ]]; then - echo "::warning::Unable to determine the head sha" - echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage" - exit 1 -fi - -echo "Diffing changes between $PREV_SHA -> $CURR_SHA" +echo "Retrieving changes between $PREV_SHA → $CURR_SHA" if [[ -z "$INPUT_FILES" ]]; then echo "Getting diff..."