Skip to content

Instantly share code, notes, and snippets.

@adrianalonso
Created May 24, 2020 06:28
Show Gist options
  • Select an option

  • Save adrianalonso/0d01b12a98f4fd6e80e48f3fd44dea7d to your computer and use it in GitHub Desktop.

Select an option

Save adrianalonso/0d01b12a98f4fd6e80e48f3fd44dea7d to your computer and use it in GitHub Desktop.

Revisions

  1. adrianalonso created this gist May 24, 2020.
    29 changes: 29 additions & 0 deletions pipedream-circleci.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    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;
    };