Skip to content

Instantly share code, notes, and snippets.

@adrianalonso
Created May 24, 2020 06:28
Show Gist options
  • Save adrianalonso/0d01b12a98f4fd6e80e48f3fd44dea7d to your computer and use it in GitHub Desktop.
Save adrianalonso/0d01b12a98f4fd6e80e48f3fd44dea7d to your computer and use it in GitHub Desktop.
Pipedream Function to Trigger Build on CircleCI
async (event, steps) => {
const CircleCI = require("circleci-api");
const options = {
token: process.env.CIRCLECI_TOKEN,
vcs: {
type: process.env.CIRCLECI_REPOSITORY_PLATFORM,
owner: process.env.CIRCLECI_OWNER,
repo: process.env.CIRCLECI_REPOSITORY,
},
options: {
branch: process.env.CIRCLECI_BRANCH,
filter: "completed",
},
};
const api = new CircleCI.CircleCI(options);
let response = await api.triggerBuild({
options: {
newBuildOptions: {
build_parameters: {
CIRCLE_JOB: process.env.CIRCLECI_JOB,
},
},
},
});
return response;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment