#!/bin/bash if [ ! -f ups.json ]; then echo "ups.json not found" exit 1 fi git add ups.json if git diff --exit-code --cached &> /dev/null; then echo "no updates for ups.json" exit 1 fi diff=$(git blame ups.json | grep 'Not Committed Yet' | grep '"commit"') if [ -z "${diff}" ]; then echo "no updates for ups.json" exit 1 fi commit=$(echo "${diff}" | awk '{print $10}' | sed -e 's/"//g' -e 's/,//g') git commit -m "ups: update to ${commit:0:7}"