Pushed changes to address www.bunny-lab.io pull issues

This commit is contained in:
Nicole Rappe 2024-09-10 05:15:06 -06:00
parent cf1ef7c848
commit 24b1245cea

View File

@ -18,8 +18,16 @@ process_repo() {
fi
cd "$REPO_DIR" || exit
# Detect the default branch dynamically
DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
# Check if an upstream is configured; if not, set it
if ! git rev-parse @{u} > /dev/null 2>&1; then
git branch --set-upstream-to=origin/$DEFAULT_BRANCH $DEFAULT_BRANCH
fi
# Fetch the latest changes
git fetch origin main > /dev/null 2>&1
git fetch origin $DEFAULT_BRANCH > /dev/null 2>&1
# Check if the local repository is behind the remote
LOCAL=$(git rev-parse @)
@ -27,7 +35,7 @@ process_repo() {
if [ "$LOCAL" != "$REMOTE" ]; then
curl -d "Updating: $CLEAN_REPO_URL" $NTFY_URL
git pull origin main > /dev/null 2>&1
git pull origin $DEFAULT_BRANCH > /dev/null 2>&1
rsync -av --delete --exclude '.git/' ./ "$DESTINATION" > /dev/null 2>&1
fi
}
@ -48,6 +56,6 @@ while true; do
process_repo "$REPO_URL" "$DESTINATION"
done
# Wait for 5 seconds before the next iteration
sleep 5
# Wait for 30 seconds before the next iteration
sleep 30
done