Created
December 2, 2020 10:18
-
-
Save dario-valles/f8b8c3dbe27e0fcb0b80146a854b7f85 to your computer and use it in GitHub Desktop.
This script pull changes on current branch, pushes your changes, checks if there are some pending CI tasks and pull changes when tasks are done (gh client needed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
currentBranch=`git branch --show-current` | |
currentBranch="${currentBranch}" | |
echo "🛬 Pulling changes from current ${currentBranch}" | |
git pull origin $currentBranch | |
echo "🛫 Pushing changes from your current ${currentBranch}" | |
git push origin $currentBranch | |
ghCommand=`gh api /repos/:owner/:repo/commits/:branch/status | python -c 'import json, sys; print(json.loads(sys.stdin.read())["state"]);'` | |
export result=($ghCommand); | |
while [[ "$result" != "success" ]]; | |
do | |
ghCommand=`gh api /repos/:owner/:repo/commits/:branch/status | python -c 'import json, sys; print(json.loads(sys.stdin.read())["state"]);'` | |
export result=($ghCommand); | |
echo $result | |
sleep 2 | |
done | |
echo "🛬 Update ${currentBranch} with styleci changes" | |
git pull origin $currentBranch | |
echo "🚀 FINISH 🚀" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment