diff --git a/.github/workflows/untrustedPR.yml b/.github/workflows/untrustedPR.yml index 35c5b9ea4d..d68c414569 100644 --- a/.github/workflows/untrustedPR.yml +++ b/.github/workflows/untrustedPR.yml @@ -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") + 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