3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-16 19:27:39 +00:00

Updated git fetch to pull the last remote commit (#254)

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh
This commit is contained in:
Tonye Jack 2021-11-19 16:27:56 -05:00 committed by GitHub
parent bb40edd264
commit 467d26c8b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,15 +62,18 @@ if [[ -z $GITHUB_BASE_REF ]]; then
else
TARGET_BRANCH=$GITHUB_BASE_REF
CURRENT_BRANCH=$GITHUB_HEAD_REF
git fetch temp_changed_files --no-tags -u "${TARGET_BRANCH}":"${TARGET_BRANCH}"
if [[ -z $INPUT_BASE_SHA ]]; then
git fetch --no-tags -u --progress --depth=1 temp_changed_files "${TARGET_BRANCH}":"${TARGET_BRANCH}"
PREVIOUS_SHA=$(git rev-parse "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$?
else
git fetch --no-tags -u --progress --depth=1 temp_changed_files "$INPUT_BASE_SHA"
PREVIOUS_SHA=$INPUT_BASE_SHA
fi
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the base ref sha for ${TARGET_BRANCH}"
echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
git remote remove temp_changed_files
exit 1
fi