mirror of
https://github.com/tj-actions/changed-files
synced 2025-01-16 23:17:49 +00:00
fix: handle errors for repositories without any previous commit history (#404)
* fix: Handle errors for repositories without any previous commit history Fixes: #365 * Update diff-sha.sh
This commit is contained in:
parent
f5d5eb9133
commit
a53d74f700
1 changed files with 5 additions and 1 deletions
|
@ -52,7 +52,11 @@ if [[ -z $GITHUB_BASE_REF ]]; then
|
|||
CURRENT_BRANCH=$TARGET_BRANCH
|
||||
|
||||
if [[ -z $INPUT_BASE_SHA ]]; then
|
||||
PREVIOUS_SHA=$(git rev-list --no-merges -n 1 HEAD^1 2>&1) && exit_status=$? || exit_status=$?
|
||||
if [[ $(git rev-list --count HEAD) -gt 1 ]]; then
|
||||
PREVIOUS_SHA=$(git rev-list --no-merges -n 1 HEAD^1 2>&1) && exit_status=$? || exit_status=$?
|
||||
else
|
||||
PREVIOUS_SHA=$CURRENT_SHA
|
||||
fi
|
||||
else
|
||||
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
|
||||
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$?
|
||||
|
|
Loading…
Reference in a new issue