Skip to content

Instantly share code, notes, and snippets.

@jbmlaird
Created January 8, 2019 15:33
Show Gist options
  • Save jbmlaird/059466e72c6e547995cfe3e199f8a51e to your computer and use it in GitHub Desktop.
Save jbmlaird/059466e72c6e547995cfe3e199f8a51e to your computer and use it in GitHub Desktop.
Manually run a CircleCI build via the API
#!/usr/bin/env bash
# Run CircleCI builds manually using this script
# Most useful for when you have a workflow set up that doesn't execute on the branch that you are pushing to
export CIRCLE_TOKEN=YOUR_CIRCLE_TOKEN
export GIT_COMMIT_REVISION=YOUR_GIT_COMMIT_REVISION_TO_BUILD
export VSC=github
export VSC_ACCOUNT=YOUR_VSC_USERNAME
export VSC_REPO_NAME=YOUR_VSC_REPO_NAME
export VSC_REPO_BRANCH_NAME=YOUR_VSC_BRANCH_NAME
curl --user ${CIRCLE_TOKEN}:\
--request POST\
--form revision=GIT_COMMIT_REVISION\
--form config=@config.yml\
--form notify=false\
https://circleci.com/api/v1.1/project/${VSC}/${VSC_ACCOUNT}/${VSC_REPO_NAME}/tree/${VSC_REPO_BRANCH_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment