{ "kind": "open-flow-workflow", "version": 1, "name": "Publish New GitLab Releases to Outline", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_cb90ddd035daf9af": { "name": "Receive GitLab release events", "kind": "integration", "config": { "project": { "kind": "value", "value": "YOUR_GROUP/YOUR_PROJECT" }, "events": { "kind": "value", "value": [ "releases" ] }, "insecureSsl": { "kind": "value", "value": false }, "pushBranchFilter": { "kind": "value", "value": "" } }, "definition": { "configInputs": [ { "jsonSchema": { "type": "array", "items": { "type": "string", "enum": [ "push", "tag_push", "issues", "confidential_issues", "note", "confidential_note", "merge_requests", "job", "pipeline", "wiki_page", "deployment", "feature_flag", "releases", "milestone", "emoji", "resource_access_token", "resource_deploy_token" ] }, "minItems": 1, "uniqueItems": true }, "nullable": false, "handle": "events" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "insecureSsl", "value": false }, { "jsonSchema": { "type": "string", "minLength": 1, "maxLength": 255, "pattern": "^(?:[0-9]+|(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*)*)$" }, "nullable": false, "handle": "project" }, { "jsonSchema": { "type": "string", "maxLength": 255 }, "nullable": false, "handle": "pushBranchFilter", "value": "" } ], "definitionVersion": 2, "description": "Triggers when selected GitLab webhook events occur in a project.", "displayName": "Project Event", "key": "gitlab.on_project_event", "name": "on_project_event", "outputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "deliveryId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "event" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "gitlabEvent" } ], "provider": "gitlab", "type": "integration", "endpoint": { "body": { "allowArray": false, "allowEmpty": false, "formats": [ "json" ] }, "methods": [ "POST" ], "successStatus": 202 } } }, "n_e0fdb206a17fd569": { "inputs": { "event": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_cb90ddd035daf9af", "output": "body" } ] }, "collectionId": { "kind": "value", "value": "YOUR_COLLECTION_ID" }, "parentDocumentId": { "kind": "value", "value": "" } }, "name": "Prepare the release document", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "event" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "collectionId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "parentDocumentId" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "publish" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Prepare the release document", "moduleId": "n_4489d7517715b5e4", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_ebfc9627fae0acad": { "inputs": {}, "name": "New release?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_e0fdb206a17fd569", "output": "publish" } }, "operator": "isTrue" } ] } ] } ] }, "n_cb2083669ee87e15": { "inputs": { "endpoint": { "kind": "value", "value": "/documents.create" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_e0fdb206a17fd569", "output": "body" } ] } }, "name": "Publish the Outline document", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "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": "Publish the Outline document", "executor": { "providerId": "outline", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_3552588892f861a2": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_cb2083669ee87e15", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_cb2083669ee87e15", "output": "statusCode" } ] } }, "name": "Confirm the document", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "document" } ], "name": "Confirm the document", "moduleId": "n_824f42080b023899", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_a5d97cd4328ce59b": { "name": "Published document", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "document" } ], "outputMappings": { "document": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3552588892f861a2", "output": "document" } ] } } } }, "edges": [ { "source": "n_cb90ddd035daf9af", "target": "n_e0fdb206a17fd569" }, { "source": "n_e0fdb206a17fd569", "target": "n_ebfc9627fae0acad" }, { "source": "n_ebfc9627fae0acad", "target": "n_cb2083669ee87e15", "sourceHandle": "yes" }, { "source": "n_cb2083669ee87e15", "target": "n_3552588892f861a2" }, { "source": "n_3552588892f861a2", "target": "n_a5d97cd4328ce59b" } ] } }, "modules": { "n_4489d7517715b5e4": { "name": "Prepare the release document", "imports": [], "source": "export default function prepare({event,collectionId,parentDocumentId}){if(!event||event.object_kind!=='release'||!['create','update','delete'].includes(event.action))throw Error('Invalid GitLab release event');if(event.action!=='create')return{publish:false,body:{}};if(typeof event.name!=='string'||!event.name.trim()||typeof event.url!=='string'||!/^https?:\\/\\/\\S+$/i.test(event.url))throw Error('Invalid GitLab release');if(typeof collectionId!=='string'||!collectionId.trim()||collectionId.startsWith('YOUR_'))throw Error('Configure the Outline collection ID');if(typeof parentDocumentId!=='string'||parentDocumentId.startsWith('YOUR_'))throw Error('Configure or clear the parent document ID');const description=event.description==null?'':event.description;if(typeof description!=='string')throw Error('Invalid release description');return{publish:true,body:{collectionId,...(parentDocumentId.trim()?{parentDocumentId:parentDocumentId.trim()}:{}),publish:true,title:'Release '+event.name,text:description+'\\n\\n\\\\\\n[More info]('+event.url+')'}}}\n" }, "n_824f42080b023899": { "name": "Confirm the document", "imports": [], "source": "export default function confirm({body,statusCode}){if(statusCode<200||statusCode>=300||!body||body.ok===false||typeof body.data?.id!=='string'||!body.data.id)throw Error('Outline document was not confirmed; inspect before retry');return{document:body.data}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }