From 1f938f0f232932d7ce885d538c8ca49b33b65591 Mon Sep 17 00:00:00 2001 From: Jonathan DeMasi Date: Tue, 20 Jan 2026 22:41:00 -0700 Subject: [PATCH] Update script so we don't keep deleting and re-cloning for no reason --- misc/ansible-runner.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/misc/ansible-runner.sh b/misc/ansible-runner.sh index 1f7efd2..5cd50d0 100644 --- a/misc/ansible-runner.sh +++ b/misc/ansible-runner.sh @@ -6,12 +6,17 @@ cd /home/ansible # Ensure we have a log dir mkdir -p /home/ansible/logs -# Cleanup -rm -rf /home/ansible/infra -rm -rf /home/ansible/venv -# Clone the infra repo -git clone git@git.jthan.io:jonathan/infra /home/ansible/infra +cd /home/ansible/infra +git fetch origin > /dev/null 2>&1 + +BEHIND_COUNT=$(git rev-list --count HEAD..@{u}) + +if [ "$BEHIND_COUNT" -gt 0 ]; then + git pull +else + echo "Local branch is up to date with the remote, no changes." +fi # Create a venv python3 -m venv /home/ansible/venv