Skip to content

Instantly share code, notes, and snippets.

@sarina
Created March 24, 2025 01:20
Show Gist options
  • Save sarina/1ed98fbe5713f71cb1da9e5a2cf1d1b8 to your computer and use it in GitHub Desktop.
Save sarina/1ed98fbe5713f71cb1da9e5a2cf1d1b8 to your computer and use it in GitHub Desktop.
Output all the plugin slots that exist in a list of specified frontend-app repos
#!/bin/bash
# List of directories to visit
directories=(
"/Users/sarinacanelake/openedx/frontend-app-authoring"
"/Users/sarinacanelake/openedx/frontend-app-gradebook"
"/Users/sarinacanelake/openedx/frontend-app-account"
)
git_main_branch () {
git branch | cut -c 3- | grep -E '^master$|^main$'
}
# Ask for the branch to check out
echo -n "Enter the release branch to check out: "
read branch
# Output file
output_file="$(pwd)/plugin_slots_output.txt"
# Clear the output file
> "$output_file"
# Iterate through directories
for dir in "${directories[@]}"; do
if [ -d "$dir" ]; then
echo "$dir" >> "$output_file"
cd "$dir" || { echo "Failed to access $dir" >> "$output_file"; continue; }
# Checkout master or main & pull latest
git checkout $(git_main_branch)
git pull
# Checkout specified branch
git checkout "$branch"
# List contents of src/plugin-slots
if [ -d "src/plugin-slots" ]; then
ls "src/plugin-slots" >> "$output_file"
else
echo "No plugin slots in this repository" >> "$output_file"
fi
echo "--------------------------------" >> "$output_file"
else
echo "$dir does not exist"
fi
done
echo "Script execution completed. Output saved to $output_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment