From d679de9200b28e963362cba99095dd8d9f23d446 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Fri, 25 Jun 2021 14:58:59 -0400 Subject: [PATCH] Fixed empty branch name in debug message (#115) --- entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 97a3cb6c..2f47fcde 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,6 +19,8 @@ fi if [[ -z $GITHUB_BASE_REF ]]; then PREV_SHA=$(git rev-parse HEAD^1 2>&1) && exit_status=$? || exit_status=$? + TARGET_BRANCH=${GITHUB_REF/refs\/heads\//} + CURRENT_BRANCH=$TARGET_BRANCH if [[ $exit_status -ne 0 ]]; then echo "::warning::Unable to determine the previous commit sha" @@ -27,6 +29,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then fi else TARGET_BRANCH=${GITHUB_BASE_REF} + CURRENT_BRANCH=$GITHUB_HEAD_REF git fetch --depth=1 origin "${TARGET_BRANCH}":"${TARGET_BRANCH}" PREV_SHA=$(git rev-parse "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? @@ -36,7 +39,7 @@ else fi fi -echo "Retrieving changes between $PREV_SHA ($TARGET_BRANCH) ← $CURR_SHA ($GITHUB_HEAD_REF)" +echo "Retrieving changes between $PREV_SHA ($TARGET_BRANCH) ← $CURR_SHA ($CURRENT_BRANCH)" if [[ -z "$INPUT_FILES" ]]; then echo "Getting diff..."