3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-17 13:47:20 +00:00

chore: fix bug with base sha

This commit is contained in:
Tonye Jack 2022-10-02 06:29:15 -06:00 committed by GitHub
parent dc786e7809
commit 02c995141e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,18 +21,4 @@ if [[ -n "$INPUT_SINCE" ]]; then
echo "::set-output name=base_sha::$BASE_SHA" echo "::set-output name=base_sha::$BASE_SHA"
elif [[ -n "$INPUT_BASE_SHA" ]]; then elif [[ -n "$INPUT_BASE_SHA" ]]; then
echo "::set-output name=base_sha::$INPUT_BASE_SHA" echo "::set-output name=base_sha::$INPUT_BASE_SHA"
elif [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then
LAST_REMOTE_COMMIT=""
if [[ "$GITHUB_EVENT_FORCED" == "false" ]]; then
LAST_REMOTE_COMMIT=$GITHUB_EVENT_BEFORE
fi
if [[ -z "$LAST_REMOTE_COMMIT" || "$LAST_REMOTE_COMMIT" == "0000000000000000000000000000000000000000" ]]; then
LAST_REMOTE_COMMIT=$(git rev-parse "$(git branch -r --sort=-committerdate | head -1 | xargs)")
fi
if [[ "$INPUT_SHA" == "$LAST_REMOTE_COMMIT" ]]; then
LAST_REMOTE_COMMIT=$(git rev-parse "$INPUT_SHA"^1)
fi
echo "::set-output name=base_sha::$LAST_REMOTE_COMMIT"
fi fi