Skip to content

Instantly share code, notes, and snippets.

@mislav
Created October 3, 2016 21:16
Show Gist options
  • Save mislav/e7dbb6f01abae753b07d50f734baa362 to your computer and use it in GitHub Desktop.
Save mislav/e7dbb6f01abae753b07d50f734baa362 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