{ "kind": "open-flow-workflow", "version": 1, "name": "CircleCI Pipeline Lookup", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_c8c1d9f1491381c9": { "name": "Enter pipeline details", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "enum": [ "github", "bitbucket" ] }, "nullable": false, "handle": "vcs" }, { "jsonSchema": { "type": "string", "minLength": 3, "pattern": "^[^/]+/[^/]+$" }, "nullable": false, "handle": "projectSlug" }, { "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "nullable": false, "handle": "pipelineNumber" } ] }, "n_9b4a5db1c5321d92": { "inputs": { "vcs": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c8c1d9f1491381c9", "output": "vcs" } ] }, "projectSlug": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c8c1d9f1491381c9", "output": "projectSlug" } ] }, "pipelineNumber": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c8c1d9f1491381c9", "output": "pipelineNumber" } ] } }, "name": "Prepare project pipeline lookup", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "enum": [ "github", "bitbucket" ] }, "nullable": false, "handle": "vcs" }, { "jsonSchema": { "type": "string", "minLength": 3, "pattern": "^[^/]+/[^/]+$" }, "nullable": false, "handle": "projectSlug" }, { "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "nullable": false, "handle": "pipelineNumber" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" } ], "name": "Prepare project pipeline lookup", "moduleId": "n_be5d9a5b965e3abf", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_d3ed1e5d2a1165e1": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9b4a5db1c5321d92", "output": "endpoint" } ] } }, "name": "Read CircleCI pipeline by number", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "name": "Read CircleCI pipeline by number", "executor": { "providerId": "circleci", "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "kind": "connector-proxy" } } }, "n_5a9e7489647b16f0": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d3ed1e5d2a1165e1", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d3ed1e5d2a1165e1", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d3ed1e5d2a1165e1", "output": "bodyEncoding" } ] } }, "name": "Read pipeline result", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "pipeline" } ], "name": "Read pipeline result", "moduleId": "n_f59eeeb833d34a95", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_d923ff6cde06690d": { "name": "Pipeline details", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "pipeline" } ], "outputMappings": { "pipeline": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5a9e7489647b16f0", "output": "pipeline" } ] } } } }, "edges": [ { "source": "n_c8c1d9f1491381c9", "target": "n_9b4a5db1c5321d92" }, { "source": "n_9b4a5db1c5321d92", "target": "n_d3ed1e5d2a1165e1" }, { "source": "n_d3ed1e5d2a1165e1", "target": "n_5a9e7489647b16f0" }, { "source": "n_5a9e7489647b16f0", "target": "n_d923ff6cde06690d" } ] } }, "modules": { "n_be5d9a5b965e3abf": { "name": "Prepare project pipeline lookup", "imports": [], "source": "export default function pipelineRequest({ vcs, projectSlug, pipelineNumber }) {\n if (!['github', 'bitbucket'].includes(vcs)) throw new Error('Choose GitHub or Bitbucket');\n if (typeof projectSlug !== 'string') throw new Error('Project slug is required');\n const parts = projectSlug.split('/');\n if (parts.length !== 2 || parts.some((part) => !part.trim() || part === '.' || part === '..')) throw new Error('Use an organization/repository project slug');\n if (!Number.isSafeInteger(pipelineNumber) || pipelineNumber < 1) throw new Error('A positive pipeline number is required');\n return { endpoint: '/project/' + vcs + '/' + parts.map(encodeURIComponent).join('/') + '/pipeline/' + pipelineNumber };\n}\n" }, "n_f59eeeb833d34a95": { "name": "Read pipeline result", "imports": [], "source": "export default function pipelineResult({ body, statusCode, bodyEncoding }) {\n if (statusCode !== 200 || bodyEncoding) throw new Error('CircleCI did not return a pipeline (HTTP ' + statusCode + ')');\n if (!body || typeof body !== 'object' || Array.isArray(body) || typeof body.id !== 'string' || !body.id || !Number.isInteger(body.number) || typeof body.state !== 'string') throw new Error('CircleCI returned an unexpected pipeline response');\n return { pipeline: body };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }