diff --git a/birdnet-pi/rootfs/helpers/merge_open_prs.sh b/birdnet-pi/rootfs/helpers/merge_open_prs.sh index 8efd99639..416166472 100755 --- a/birdnet-pi/rootfs/helpers/merge_open_prs.sh +++ b/birdnet-pi/rootfs/helpers/merge_open_prs.sh @@ -10,6 +10,12 @@ if ! git rev-parse --git-dir > /dev/null 2>&1; then exit 1 fi +# If this is a shallow clone, fetch enough history to compute merge bases +if git rev-parse --is-shallow-repository >/dev/null 2>&1 && git rev-parse --is-shallow-repository | grep -q true; then + echo "🔄 Repository is shallow; fetching full history to enable merging…" + git fetch --unshallow || git fetch --deepen=100000 +fi + # Get list of open, non-draft PR numbers via GitHub API echo "🔍 Fetching open PRs..." mapfile -t PRS < <(curl -s "https://api.github.com/repos/alexbelgium/BirdNET-Pi/pulls?state=open&per_page=100" \