Skip to content

Instantly share code, notes, and snippets.

@nysalor
Created October 6, 2017 03:02
Show Gist options
  • Save nysalor/9d41b2ec2119bc5443586d25cf772b38 to your computer and use it in GitHub Desktop.
Save nysalor/9d41b2ec2119bc5443586d25cf772b38 to your computer and use it in GitHub Desktop.
CircleCI rebuild function (with peco and jq)
# set CircleCI token to $CIRCLECI_TOKEN
function ci-rebuild () {
BUILDID=$(curl -s "https://circleci.com/api/v1/recent-builds?circle-token=$CIRCLECI_TOKEN" |jq -r '.[] | "\(.username)/\(.reponame)/\(.build_num) \(.subject)"' | peco | cut -f 1 -d ' ')
if test "${BUILDID}" != ""; then
curl -X POST "https://circleci.com/api/v1/project/$BUILDID/retry?circle-token=$CIRCLECI_TOKEN"
fi
}
zle -N ci-rebuild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment