Fixed bug with detecting initial commit.
This commit is contained in:
parent
b2d17f5124
commit
039afcd102
12
diff-sha.sh
12
diff-sha.sh
@ -133,23 +133,23 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
|
|||||||
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
|
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
|
||||||
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE && exit_status=$? || exit_status=$?
|
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE && exit_status=$? || exit_status=$?
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^") && exit_status=$? || exit_status=$?
|
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^" || true) && exit_status=$? || exit_status=$?
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^") && exit_status=$? || exit_status=$?
|
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^" || true) && exit_status=$? || exit_status=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then
|
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then
|
||||||
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^") && exit_status=$? || exit_status=$?
|
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^" || true) && exit_status=$? || exit_status=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
||||||
if ! git rev-parse "$PREVIOUS_SHA^1" &>/dev/null; then
|
if ! git rev-parse "$CURRENT_SHA^1" &>/dev/null; then
|
||||||
INITIAL_COMMIT="true"
|
INITIAL_COMMIT="true"
|
||||||
PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA")
|
PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA")
|
||||||
echo "::warning::Initial commit detected no previous commit found."
|
echo "::warning::Initial commit detected no previous commit found."
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=$(git rev-parse "$PREVIOUS_SHA^1")
|
PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA^1")
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ -z "$PREVIOUS_SHA" ]]; then
|
if [[ -z "$PREVIOUS_SHA" ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user