⚙️ Trigger CircleCI builds programmatically
You can fetch this tool by running the following
go get -u github.com/joshdk/cci-trigger
You must first obtain a API key by going to your account's API page, and creating a new token. Export this API token as CIRCLE_TOKEN
into your working environment.
export CIRCLE_TOKEN='cf1...d7c'
If you have an enterprise instance of CircleCI, you can export CIRCLE_HOST
with the hostname of your internal instance.
export CIRCLE_HOST='circleci.example.com'
Starts a build on the HEAD of the default branch. This branch is typically master, and can usually be customized in your VCS platform.
$ cci-trigger username/project
https://circleci.com/gh/username/project/123
Starts a build on the given tag.
$ cci-trigger username/project --tag <TAG>
https://circleci.com/gh/username/project/123
Starts a build on the given VCS ref.
$ cci-trigger username/project --ref <REF>
https://circleci.com/gh/username/project/123
Starts a build on the HEAD of the given branch.
$ cci-trigger username/project --branch <BRANCH>
https://circleci.com/gh/username/project/123
Starts a build on the given branch at the given ref.
$ cci-trigger username/project --branch <BRANCH> --ref <REF>
https://circleci.com/gh/username/project/123
Restarts a build on the given build number.
$ cci-trigger username/project --build <BUILD>
https://circleci.com/gh/username/project/123
Restarts a build on the given build number, and enables SSH.
$ cci-trigger username/project --build <BUILD> --ssh
https://circleci.com/gh/username/project/123
If you find a bug in cci-trigger
or need additional features, please feel free to open an issue or submit a pull request.
This library is distributed under the MIT License, see LICENSE.txt for more information.