# enter the repo
cd "$GIT_ZUE_DEV" || { echo "Failed to change directory to $GIT_ZUE_DEV. PANIC!"; exit 1; }
+# array of files to check for changes
+HTML_FILES_TO_CHECK=(
+ "site_header.html"
+ "site_footer.html"
+ "home_text.html"
+)
+
+# loop through each file and check for changes
+for FILE in "${HTML_FILES_TO_CHECK[@]}"; do
+ if ! cmp -s "$DOCKER_COMPOSE_DIRECTORY/$FILE" <(git show HEAD:"html/$FILE"); then
+ echo "$FILE has changed. Updating local copy..."
+ git show HEAD:"html/$FILE" > "$DOCKER_COMPOSE_DIRECTORY/$FILE"
+ else
+ echo "$FILE has not changed. No action needed."
+ fi
+done
+
# can we see the docker-compose.yaml file in the repo?
git show HEAD:"$DOCKER_COMPOSE_FILENAME" > /dev/null 2>&1 || { echo "Failed to find $DOCKER_COMPOSE_FILENAME in the repository. PANIC!"; exit 1; }
echo "$DOCKER_COMPOSE_FILENAME has not changed. No action needed."
fi
-# return to the repo directory
-cd "$GIT_ZUE_DEV" || { echo "Failed to change directory to $GIT_ZUE_DEV. PANIC!"; exit 1; }
-
-# array of files to check for changes
-HTML_FILES_TO_CHECK=(
- "site_header.html"
- "site_footer.html"
- "home_text.html"
-)
-
-# loop through each file and check for changes
-for FILE in "${HTML_FILES_TO_CHECK[@]}"; do
- if ! cmp -s "$DOCKER_COMPOSE_DIRECTORY/$FILE" <(git show HEAD:"html/$FILE"); then
- echo "$FILE has changed. Updating local copy..."
- git show HEAD:"html/$FILE" > "$DOCKER_COMPOSE_DIRECTORY/$FILE"
- else
- echo "$FILE has not changed. No action needed."
- fi
-done
-
echo "Minutely cron job completed."
\ No newline at end of file