{ "kind": "open-flow-workflow", "version": 1, "name": "Create or Comment on GitHub Issues from Zendesk", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_d7be4f61c0bbf17a": { "name": "Receive a Zendesk event", "kind": "webhook", "bodyFields": [ { "jsonSchema": { "anyOf": [ { "type": "integer" }, { "type": "string" } ] }, "nullable": false, "handle": "id" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "comment" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "secret" } ], "method": "POST", "options": { "responseData": "{}", "responseHeaders": { "Content-Type": "application/json" }, "responseStatusCode": 200 } }, "n_a0ed459a34ad8000": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d7be4f61c0bbf17a", "output": "body" } ] }, "secret": { "kind": "unset" }, "fieldId": { "kind": "value", "value": 0 }, "owner": { "kind": "value", "value": "YOUR_GITHUB_OWNER" }, "repo": { "kind": "value", "value": "YOUR_GITHUB_REPO" } }, "name": "Validate the ticket event", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "secret" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "fieldId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "owner" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "repo" } ], "outputs": [ { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "ticketId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "comment" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "fieldId" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "owner" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "repo" } ], "name": "Validate the ticket event", "moduleId": "n_b4fea6ef61723117", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_7a455f16b5cb8719": { "inputs": { "ticketId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "ticketId" } ] } }, "name": "Read the Zendesk ticket", "kind": "task", "task": { "inputs": [ { "description": "Zendesk ticket identifier.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "Zendesk ticket identifier." }, "nullable": false, "handle": "ticketId" } ], "outputs": [ { "description": "Zendesk ticket details.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "exclusiveMinimum": 0, "description": "Zendesk ticket identifier." }, "url": { "type": [ "string", "null" ], "description": "API URL of the ticket, or null when Zendesk omits it." }, "subject": { "type": [ "string", "null" ], "description": "Ticket subject, or null when Zendesk omits it." }, "description": { "type": [ "string", "null" ], "description": "Ticket description, or null when Zendesk omits it." }, "status": { "type": [ "string", "null" ], "description": "Ticket status, or null when Zendesk omits it." }, "priority": { "type": [ "string", "null" ], "description": "Ticket priority, or null when Zendesk omits it." }, "type": { "type": [ "string", "null" ], "description": "Ticket type, or null when Zendesk omits it." }, "requesterId": { "type": [ "integer", "null" ], "description": "Requester identifier, or null when Zendesk omits it." }, "assigneeId": { "type": [ "integer", "null" ], "description": "Assignee identifier, or null when Zendesk omits it." }, "groupId": { "type": [ "integer", "null" ], "description": "Group identifier, or null when Zendesk omits it." }, "organizationId": { "type": [ "integer", "null" ], "description": "Organization identifier, or null when Zendesk omits it." }, "externalId": { "type": [ "string", "null" ], "description": "External identifier, or null when Zendesk omits it." }, "dueAt": { "type": [ "string", "null" ], "description": "Task due timestamp, or null when Zendesk omits it." }, "createdAt": { "type": [ "string", "null" ], "description": "Ticket creation timestamp, or null when Zendesk omits it." }, "updatedAt": { "type": [ "string", "null" ], "description": "Ticket update timestamp, or null when Zendesk omits it." }, "tags": { "type": "array", "items": { "type": "string", "description": "Tag attached to the ticket." }, "description": "Ticket tags." }, "raw": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Raw Zendesk ticket payload." } }, "required": [ "id", "url", "subject", "description", "requesterId", "assigneeId", "groupId", "organizationId", "externalId", "dueAt", "createdAt", "updatedAt", "tags", "raw" ], "additionalProperties": false, "description": "Zendesk ticket details." }, "nullable": false, "handle": "ticket" }, { "description": "Comments attached to the ticket.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "exclusiveMinimum": 0, "description": "Zendesk ticket comment identifier." }, "type": { "type": [ "string", "null" ], "description": "Zendesk comment type, or null when Zendesk omits it." }, "authorId": { "type": [ "integer", "null" ], "description": "Identifier of the comment author, or null when Zendesk omits it." }, "body": { "type": [ "string", "null" ], "description": "Plain-text comment body, or null when Zendesk omits it." }, "htmlBody": { "type": [ "string", "null" ], "description": "HTML comment body, or null when Zendesk omits it." }, "plainBody": { "type": [ "string", "null" ], "description": "Zendesk normalized plain-text body, or null when omitted." }, "public": { "type": [ "boolean", "null" ], "description": "Whether the comment is public, or null when Zendesk omits it." }, "createdAt": { "type": [ "string", "null" ], "description": "Comment creation timestamp, or null when Zendesk omits it." }, "attachments": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "exclusiveMinimum": 0, "description": "Zendesk attachment identifier." }, "fileName": { "type": [ "string", "null" ], "description": "Attachment file name, or null when Zendesk omits it." }, "contentType": { "type": [ "string", "null" ], "description": "Attachment MIME type, or null when Zendesk omits it." }, "size": { "type": [ "integer", "null" ], "description": "Attachment size in bytes, or null when Zendesk omits it." }, "url": { "type": [ "string", "null" ], "description": "Attachment URL, or null when Zendesk omits it." } }, "required": [ "id", "fileName", "contentType", "size", "url" ], "additionalProperties": false, "description": "Attachment returned with this comment." }, "description": "Attachments returned with the comment." }, "raw": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Raw Zendesk comment payload." } }, "required": [ "id", "type", "authorId", "body", "htmlBody", "plainBody", "public", "createdAt", "attachments", "raw" ], "additionalProperties": false, "description": "Comment associated with the requested ticket." }, "description": "Comments attached to the ticket." }, "nullable": false, "handle": "comments" } ], "name": "Read the Zendesk ticket", "executor": { "kind": "connector", "action": "zendesk.get_ticket" } } }, "n_98fac9f1ca808725": { "inputs": { "ticket": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7a455f16b5cb8719", "output": "ticket" } ] }, "ticketId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "ticketId" } ] }, "fieldId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "fieldId" } ] }, "comment": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "comment" } ] } }, "name": "Find the linked issue", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "exclusiveMinimum": 0, "description": "Zendesk ticket identifier." }, "url": { "type": [ "string", "null" ], "description": "API URL of the ticket, or null when Zendesk omits it." }, "subject": { "type": [ "string", "null" ], "description": "Ticket subject, or null when Zendesk omits it." }, "description": { "type": [ "string", "null" ], "description": "Ticket description, or null when Zendesk omits it." }, "status": { "type": [ "string", "null" ], "description": "Ticket status, or null when Zendesk omits it." }, "priority": { "type": [ "string", "null" ], "description": "Ticket priority, or null when Zendesk omits it." }, "type": { "type": [ "string", "null" ], "description": "Ticket type, or null when Zendesk omits it." }, "requesterId": { "type": [ "integer", "null" ], "description": "Requester identifier, or null when Zendesk omits it." }, "assigneeId": { "type": [ "integer", "null" ], "description": "Assignee identifier, or null when Zendesk omits it." }, "groupId": { "type": [ "integer", "null" ], "description": "Group identifier, or null when Zendesk omits it." }, "organizationId": { "type": [ "integer", "null" ], "description": "Organization identifier, or null when Zendesk omits it." }, "externalId": { "type": [ "string", "null" ], "description": "External identifier, or null when Zendesk omits it." }, "dueAt": { "type": [ "string", "null" ], "description": "Task due timestamp, or null when Zendesk omits it." }, "createdAt": { "type": [ "string", "null" ], "description": "Ticket creation timestamp, or null when Zendesk omits it." }, "updatedAt": { "type": [ "string", "null" ], "description": "Ticket update timestamp, or null when Zendesk omits it." }, "tags": { "type": "array", "items": { "type": "string", "description": "Tag attached to the ticket." }, "description": "Ticket tags." }, "raw": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Raw Zendesk ticket payload." } }, "required": [ "id", "url", "subject", "description", "requesterId", "assigneeId", "groupId", "organizationId", "externalId", "dueAt", "createdAt", "updatedAt", "tags", "raw" ], "additionalProperties": false, "description": "Zendesk ticket details." }, "nullable": false, "handle": "ticket" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "ticketId" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "fieldId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "comment" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "existing" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "issueNumber" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "comment" } ], "name": "Find the linked issue", "moduleId": "n_d27c0c4f884e2fe2", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_e44f9d6a1a919953": { "inputs": {}, "name": "Issue already linked", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_98fac9f1ca808725", "output": "existing" } }, "operator": "==", "right": { "kind": "value", "value": true } } ] } ] } ] }, "n_b12c552877955352": { "inputs": { "owner": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "owner" } ] }, "repo": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "repo" } ] }, "issueNumber": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_98fac9f1ca808725", "output": "issueNumber" } ] }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_98fac9f1ca808725", "output": "comment" } ] } }, "name": "Comment on the issue", "kind": "task", "task": { "inputs": [ { "description": "The repository owner.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The repository owner." }, "nullable": false, "handle": "owner" }, { "description": "The repository name.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The repository name." }, "nullable": false, "handle": "repo" }, { "description": "The issue number.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "The issue number." }, "nullable": false, "handle": "issueNumber" }, { "description": "The comment body.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The comment body." }, "nullable": false, "handle": "body" } ], "outputs": [ { "description": "A GitHub issue comment record.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The comment ID." }, "html_url": { "type": "string", "description": "The comment URL." }, "body": { "type": "string", "description": "The comment body." }, "user": { "type": [ "object", "null" ], "properties": { "id": { "type": "integer", "description": "The user ID." }, "login": { "type": "string", "description": "The username." }, "avatar_url": { "type": "string", "description": "The avatar URL." }, "html_url": { "type": "string", "description": "The profile URL." }, "type": { "type": "string", "description": "The account type." } }, "required": [ "id", "login" ], "additionalProperties": true, "description": "The comment author." }, "created_at": { "type": "string", "description": "The creation timestamp." }, "updated_at": { "type": "string", "description": "The last update timestamp." } }, "required": [ "id", "html_url", "body" ], "additionalProperties": true, "description": "A GitHub issue comment record." }, "nullable": false, "handle": "output" } ], "name": "Comment on the issue", "executor": { "kind": "connector", "action": "github.create_issue_comment", "outputMode": "value" } } }, "n_16ed79c66699747e": { "inputs": { "owner": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "owner" } ] }, "repo": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "repo" } ] }, "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_98fac9f1ca808725", "output": "title" } ] } }, "name": "Create a GitHub issue", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "owner" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "repo" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "title" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The issue ID." }, "number": { "type": "integer", "description": "The issue number." }, "title": { "type": "string", "description": "The issue title." }, "state": { "type": "string", "description": "The issue state." }, "html_url": { "type": "string", "description": "The issue URL." }, "body": { "type": [ "string", "null" ], "description": "The issue body." }, "comments": { "type": "integer", "description": "The number of comments." }, "user": { "type": "object", "properties": { "id": { "type": "integer", "description": "The user ID." }, "login": { "type": "string", "description": "The username." }, "avatar_url": { "type": "string", "description": "The avatar URL." }, "html_url": { "type": "string", "description": "The profile URL." }, "type": { "type": "string", "description": "The account type." } }, "required": [ "id", "login" ], "additionalProperties": true, "description": "The issue author." }, "assignees": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "description": "The user ID." }, "login": { "type": "string", "description": "The username." }, "avatar_url": { "type": "string", "description": "The avatar URL." }, "html_url": { "type": "string", "description": "The profile URL." }, "type": { "type": "string", "description": "The account type." } }, "required": [ "id", "login" ], "additionalProperties": true, "description": "A GitHub user summary." }, "description": "The assigned users." }, "labels": { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "integer", "description": "The label ID." }, "name": { "type": "string", "description": "The label name." }, "color": { "type": "string", "description": "The label color hex code." }, "description": { "type": [ "string", "null" ], "description": "The label description." } }, "required": [ "name" ], "additionalProperties": true, "description": "A GitHub label record." }, { "type": "string", "description": "A union variant." } ], "description": "An array item." }, "description": "The issue labels." }, "pull_request": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The linked pull request metadata." } }, "required": [ "id", "number", "title", "state", "html_url" ], "additionalProperties": true, "description": "A GitHub issue record." }, "nullable": false, "handle": "issue" } ], "name": "Create a GitHub issue", "moduleId": "n_da4e93ac9529f1c3", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [ { "action": "github.create_issue" } ] } ] } }, "n_29d2502278176cfc": { "inputs": { "ticketId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "ticketId" } ] }, "fieldId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a0ed459a34ad8000", "output": "fieldId" } ] }, "issue": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16ed79c66699747e", "output": "issue" } ] } }, "name": "Link the Zendesk ticket", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "ticketId" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "fieldId" }, { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The issue ID." }, "number": { "type": "integer", "description": "The issue number." }, "title": { "type": "string", "description": "The issue title." }, "state": { "type": "string", "description": "The issue state." }, "html_url": { "type": "string", "description": "The issue URL." }, "body": { "type": [ "string", "null" ], "description": "The issue body." }, "comments": { "type": "integer", "description": "The number of comments." }, "user": { "type": "object", "properties": { "id": { "type": "integer", "description": "The user ID." }, "login": { "type": "string", "description": "The username." }, "avatar_url": { "type": "string", "description": "The avatar URL." }, "html_url": { "type": "string", "description": "The profile URL." }, "type": { "type": "string", "description": "The account type." } }, "required": [ "id", "login" ], "additionalProperties": true, "description": "The issue author." }, "assignees": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "description": "The user ID." }, "login": { "type": "string", "description": "The username." }, "avatar_url": { "type": "string", "description": "The avatar URL." }, "html_url": { "type": "string", "description": "The profile URL." }, "type": { "type": "string", "description": "The account type." } }, "required": [ "id", "login" ], "additionalProperties": true, "description": "A GitHub user summary." }, "description": "The assigned users." }, "labels": { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "integer", "description": "The label ID." }, "name": { "type": "string", "description": "The label name." }, "color": { "type": "string", "description": "The label color hex code." }, "description": { "type": [ "string", "null" ], "description": "The label description." } }, "required": [ "name" ], "additionalProperties": true, "description": "A GitHub label record." }, { "type": "string", "description": "A union variant." } ], "description": "An array item." }, "description": "The issue labels." }, "pull_request": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The linked pull request metadata." } }, "required": [ "id", "number", "title", "state", "html_url" ], "additionalProperties": true, "description": "A GitHub issue record." }, "nullable": false, "handle": "issue" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "exclusiveMinimum": 0, "description": "Zendesk ticket identifier." }, "url": { "type": [ "string", "null" ], "description": "API URL of the ticket, or null when Zendesk omits it." }, "subject": { "type": [ "string", "null" ], "description": "Ticket subject, or null when Zendesk omits it." }, "description": { "type": [ "string", "null" ], "description": "Ticket description, or null when Zendesk omits it." }, "status": { "type": [ "string", "null" ], "description": "Ticket status, or null when Zendesk omits it." }, "priority": { "type": [ "string", "null" ], "description": "Ticket priority, or null when Zendesk omits it." }, "type": { "type": [ "string", "null" ], "description": "Ticket type, or null when Zendesk omits it." }, "requesterId": { "type": [ "integer", "null" ], "description": "Requester identifier, or null when Zendesk omits it." }, "assigneeId": { "type": [ "integer", "null" ], "description": "Assignee identifier, or null when Zendesk omits it." }, "groupId": { "type": [ "integer", "null" ], "description": "Group identifier, or null when Zendesk omits it." }, "organizationId": { "type": [ "integer", "null" ], "description": "Organization identifier, or null when Zendesk omits it." }, "externalId": { "type": [ "string", "null" ], "description": "External identifier, or null when Zendesk omits it." }, "dueAt": { "type": [ "string", "null" ], "description": "Task due timestamp, or null when Zendesk omits it." }, "createdAt": { "type": [ "string", "null" ], "description": "Ticket creation timestamp, or null when Zendesk omits it." }, "updatedAt": { "type": [ "string", "null" ], "description": "Ticket update timestamp, or null when Zendesk omits it." }, "tags": { "type": "array", "items": { "type": "string", "description": "Tag attached to the ticket." }, "description": "Ticket tags." }, "raw": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Raw Zendesk ticket payload." } }, "required": [ "id", "url", "subject", "description", "requesterId", "assigneeId", "groupId", "organizationId", "externalId", "dueAt", "createdAt", "updatedAt", "tags", "raw" ], "additionalProperties": false, "description": "Zendesk ticket returned after the mutation." }, "nullable": false, "handle": "ticket" } ], "name": "Link the Zendesk ticket", "moduleId": "n_7496a22a571b9f6f", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [ { "action": "zendesk.update_ticket" } ] } ] } } }, "edges": [ { "source": "n_d7be4f61c0bbf17a", "target": "n_a0ed459a34ad8000" }, { "source": "n_a0ed459a34ad8000", "target": "n_7a455f16b5cb8719" }, { "source": "n_7a455f16b5cb8719", "target": "n_98fac9f1ca808725" }, { "source": "n_98fac9f1ca808725", "target": "n_e44f9d6a1a919953" }, { "source": "n_e44f9d6a1a919953", "target": "n_b12c552877955352", "sourceHandle": "yes" }, { "source": "n_e44f9d6a1a919953", "target": "n_16ed79c66699747e", "sourceHandle": "otherwise" }, { "source": "n_16ed79c66699747e", "target": "n_29d2502278176cfc" } ] } }, "modules": { "n_b4fea6ef61723117": { "name": "Validate the ticket event", "imports": [], "source": "export default function request({body,secret,fieldId,owner,repo}) {\n if(typeof secret!=='string'||secret.length<24||body?.secret!==secret)throw Error('Invalid webhook secret');\n const rawId=body?.id;if(!((typeof rawId==='string'&&/^\\d+$/.test(rawId))||typeof rawId==='number'))throw Error('Invalid ticket ID');const ticketId=Number(rawId);if(!Number.isSafeInteger(ticketId)||ticketId<1)throw Error('Invalid ticket ID');\n if(!Number.isSafeInteger(fieldId)||fieldId<1||!owner||owner==='YOUR_GITHUB_OWNER'||!repo||repo==='YOUR_GITHUB_REPO')throw Error('Configure the custom field and GitHub repository');\n const comment=body?.comment;if(comment!=null&&typeof comment!=='string')throw Error('Invalid comment');return {ticketId,comment:comment??'',fieldId,owner,repo};\n}\n" }, "n_d27c0c4f884e2fe2": { "name": "Find the linked issue", "imports": [], "source": "export default function route({ticket,ticketId,fieldId,comment}) {\n if(ticket?.id!==ticketId||!Array.isArray(ticket?.raw?.custom_fields))throw Error('Ticket ID or custom fields invalid');\n const matches=ticket.raw.custom_fields.filter(x=>x?.id===fieldId);if(matches.length!==1)throw Error('Configured GitHub issue field is absent or duplicated');\n const value=matches[0].value;if(value==null||value===''){if(typeof ticket.subject!=='string'||!ticket.subject.trim())throw Error('Ticket subject is missing');return {existing:false,issueNumber:1,title:ticket.subject,comment:'-'};}\n const text=String(value);if(!/^\\d+$/.test(text)||!Number.isSafeInteger(Number(text))||Number(text)<1)throw Error('Invalid stored GitHub issue number');\n if(!comment.trim())throw Error('A comment is required for an existing issue');return {existing:true,issueNumber:Number(text),title:ticket.subject||'-',comment};\n}\n" }, "n_da4e93ac9529f1c3": { "name": "Create a GitHub issue", "imports": [], "source": "export default async function create({owner,repo,title},context) {return {issue:await context.actions.call('github.create_issue',{owner,repo,title,body:'',labels:[],assignees:[]})};}\n" }, "n_7496a22a571b9f6f": { "name": "Link the Zendesk ticket", "imports": [], "source": "export default async function update({ticketId,fieldId,issue},context) {\n if(!Number.isSafeInteger(issue?.number)||issue.number<1)throw Error('Created issue has no number');\n return await context.actions.call('zendesk.update_ticket',{ticketId,customFields:[{id:fieldId,value:issue.number}]});\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }