Handle shallow clones in merge_open_prs.sh

Add logic to handle shallow repositories in merge script
This commit is contained in:
Alexandre
2025-09-13 09:11:28 +02:00
committed by GitHub
parent 5be5fdfd8a
commit 7356016af2

View File

@@ -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" \