Fixing CircleCI configuration without spamming commits

It bugs me that fixing CI config files requires committing and pushing to the repo. It seemed like I should be able to edit the config without creating an actual commit, as when changing a project's architecture (new testing framework, etc) I often need several tries to get the CI right.

Thankfully I found this post describing how to do just that with the CircleCI API.

So I cleaned it up into a quick bash script which automatically extracts the repo name using git config.

#!/usr/bin/env bash
# -- Tries to run a new .circleci/config.yml from a checked out github repo without committing
# Usage: from the toplevel of a Git repo
# Requires $CIRCLECI_CLI_TOKEN to be set
# Thanks:

set -x 
GITHUB_REPO_STR=`git config --get remote.origin.url`

if [ $RESULT -eq 0 ]; then
  if [[ $GITHUB_REPO_STR =~[-0-9a-zA-Z\/]+) ]]; then
    #echo ${BASH_REMATCH[1]}
    curl --user ${CIRCLECI_CLI_TOKEN}: \
       --request POST \
       --form config=@.circleci/config.yml \
       --form notify=false \${BASH_REMATCH[1]}/tree/master
    echo ${BASH_REMATCH}
    echo " Failed to match github repo. Are you sure you're in a repo checked out from GitHub?"

  echo " git config --get remote.origin.url failed. Are you sure you're in a git repository?"

Feel free to send questions, comments and suggestions to

If you enjoy this sort of thing, you should come be my manager or check out our other job openings.