Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# 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*/
# 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
echo "Skipping $(basename $(pwd)) (no changes detected)."
# cd back to parent directory.
cd ..
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.