#!/bin/bash

# Define an array of folder names
#folders=$(cat allinstances.txt)
mapfile -t folders < allinstances.txt
# Loop through each folder
for folder in "${folders[@]}"
do
    # Navigate into the folder
    #cd "/var/www/html/ && cd $folder" || continue

    # Get the currently deployed branch
    branch=$(cd /var/www/html/$folder && sudo git rev-parse --abbrev-ref HEAD 2>/dev/null)

    # Print the folder name and the deployed branch
    echo "$folder, Deployed Branch: $branch"

    # Navigate back to the previous directory
    cd ..
done

