Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
#
# Add a commit and push to origin for each 'geerlingguy.*'' Ansible role.
message="Remove sudo requirement from Travis build."
# Loop through all directories starting with "geerlingguy".
for dir in ./geerlingguy*/
do
# cd into role directory.
cd "$dir"
# Check if there's a change in the work tree.
if ! git diff --no-ext-diff --quiet --exit-code; then
echo "Change detected in $(basename $(pwd)). Committing and pushing changes."
git commit -a -m "$message" && git push
else
echo "Skipping $(basename $(pwd)) (no changes detected)."
fi
# cd back to parent directory.
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.