Skip to content

Instantly share code, notes, and snippets.

@dario-valles
Created December 2, 2020 10:18
Show Gist options
  • Save dario-valles/f8b8c3dbe27e0fcb0b80146a854b7f85 to your computer and use it in GitHub Desktop.
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)
#!/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