#!/bin/bash
# Directory where branches are stored
BRANCHES_DIR="/html/branches"
# Generate index.html file
generate_index_html() {
cat << EOF
List of Branches
List of Branches
EOF
# Loop through folders in ./branches/ excluding "assets"
for branch_folder in "$BRANCHES_DIR"/*; do
branch_name=$(basename "$branch_folder")
if [ "$branch_name" != "assets" ] && [ -f "$branch_folder/index.html" ]; then
echo " - $branch_name
"
fi
done
cat << EOF
EOF
}
generate_index_html > /html/index.html