Created
May 24, 2020 06:28
-
-
Save adrianalonso/0d01b12a98f4fd6e80e48f3fd44dea7d to your computer and use it in GitHub Desktop.
Pipedream Function to Trigger Build on CircleCI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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