Try --unshallow if fetch-depth: 50 is insufficient (#52255)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Billy O'Neal 2026-06-08 12:51:53 -07:00 committed by GitHub
parent 39688db755
commit fe7c83bd1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -33,7 +33,15 @@ jobs:
synthetic_merge_commit=$(git rev-parse HEAD)
target_branch_commit=$(git rev-parse HEAD^1)
incoming_branch_commit=$(git rev-parse HEAD^2)
merge_base=$(git merge-base "$target_branch_commit" "$incoming_branch_commit" || true)
if [ -z "$merge_base" ]; then
# The two tips can exist in a shallow repository without enough
# ancestry to discover their merge-base.
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
git fetch --no-tags --unshallow origin
fi
merge_base=$(git merge-base "$target_branch_commit" "$incoming_branch_commit")
fi
git diff --name-status --merge-base HEAD^ HEAD --diff-filter=MAR -- '*portfile.cmake' | sed 's/[MAR]\t*//' > .github-pr.changed-portfiles
if [ -s .github-pr.changed-portfiles ]; then (grep -n -H -E '(vcpkg_apply_patches|vcpkg_build_msbuild|vcpkg_extract_source_archive_ex)' $(cat .github-pr.changed-portfiles) || true) > .github-pr.deprecated-function; else touch .github-pr.deprecated-function; fi