Skip to content

Instantly share code, notes, and snippets.

@kirs
Forked from mislav/promote.sh
Created October 3, 2016 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirs/dba2f57415102612ae6f2c3daa16f547 to your computer and use it in GitHub Desktop.
Save kirs/dba2f57415102612ae6f2c3daa16f547 to your computer and use it in GitHub Desktop.
Publish a git branch and open a tmux split that reports the outcome of CI
#!/bin/bash
# Pushes the current branch to origin and opens a tiny tmux split to track
# the CI status. Upon completion, speaks the status aloud using `say`.
set -e
if [ "$1" != "--wait" ]; then
git push -u origin HEAD
tmux split-window -dv -l 2 "'$0' --wait"
else
ref="$(git rev-parse -q HEAD)"
branch="$(git symbolic-ref --short -q HEAD)"
while sleep 10; do
STATUS=0
output="$(hub ci-status "$ref" 2>&1)" || STATUS="$?"
if [ "$STATUS" -eq 2 ]; then
printf '*'
elif [ "$STATUS" -eq 3 ]; then
printf '.'
else
echo " $output"
say -v fred "$branch is $output"
exit "$STATUS"
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment