on-circle
provides a set of utility for configuring and running
scripts on CircleCI.
It comes with a command line interface to follow a project, set environment variables and trigger a specific job. It can also be used in a node script to provide a sandboxed environment to execute code on CircleCI.
# Follow the current project to CircleCI
yarn run oncircle follow
# Set an ENV variable
yarn run oncircle setenv API_KEY=4815162342
# Trigger a specific job
yarn run oncircle trigger dailyUpdate
// Run this from a job running on CircleCI
const onCircle = require('on-circle');
await onCircle.run(
async (success, failure, repo }) => {
// Run any custom code here, for example calling
// external APIs to update some data.
// You can even update the repo and push back
// (check https://projects.pixelastic.com/gilmore/ for documentation)
if (everythingIsOk) {
return success('Everything worked');
} else {
return failure('Something is broken');
}
// Oh, and any error will be caught and transformed
// into a GitHub issue
}
});