Usage: push_build <branch-name:required>
Shell: fish
Pushes the given branch to GitHub, triggers a build on CircleCI, and signs you up for Mac notifications to let you know if the build passed or failed when it is done.
function push_build
if test (count $argv) -eq 0
echo "Must include a branch name"
else
echo "Pushing and building $1..."
git push --set-upstream origin $argv[1]
sleep 0.5
set trigger_result (circleci trigger gospotcheck/gospotcheck $argv[1])
set build_num (echo $trigger_result | ruby -e "require 'JSON';json=JSON.parse(STDIN.read); puts json['build_num']")
echo "Triggered build $build_num"
circleci notify gospotcheck/gospotcheck $build_num &
end
end
$ brew tap rockymadden/rockymadden
$ brew install circleci-cli
$ circleci init
<< paste in a personal API token generated from CircleCI's website under Settings >>
This causes major problems if you pass in HEAD as the name of the branch. It doesn't get interpolated to your branch name, resulting in an actual branch named HEAD.
I've opened this issue with the original CLI author, but we need to fix this script to protect against this as well. rockymadden/circleci-cli#53