Pushed changes to address www.bunny-lab.io pull issues
This commit is contained in:
parent
cf1ef7c848
commit
24b1245cea
@ -18,8 +18,16 @@ process_repo() {
|
|||||||
fi
|
fi
|
||||||
cd "$REPO_DIR" || exit
|
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
|
# 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
|
# Check if the local repository is behind the remote
|
||||||
LOCAL=$(git rev-parse @)
|
LOCAL=$(git rev-parse @)
|
||||||
@ -27,7 +35,7 @@ process_repo() {
|
|||||||
|
|
||||||
if [ "$LOCAL" != "$REMOTE" ]; then
|
if [ "$LOCAL" != "$REMOTE" ]; then
|
||||||
curl -d "Updating: $CLEAN_REPO_URL" $NTFY_URL
|
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
|
rsync -av --delete --exclude '.git/' ./ "$DESTINATION" > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -48,6 +56,6 @@ while true; do
|
|||||||
process_repo "$REPO_URL" "$DESTINATION"
|
process_repo "$REPO_URL" "$DESTINATION"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Wait for 5 seconds before the next iteration
|
# Wait for 30 seconds before the next iteration
|
||||||
sleep 5
|
sleep 30
|
||||||
done
|
done
|
Loading…
x
Reference in New Issue
Block a user