From b9b8c92e8b65c50a7dd26c357e4785c577abc4b5 Mon Sep 17 00:00:00 2001 From: Wolfgang Amann Date: Mon, 4 Mar 2024 13:43:39 +0100 Subject: [PATCH] feat(github): create pull request --- .../element-templates/github-connector.json | 201 +++++++++++++++++- 1 file changed, 198 insertions(+), 3 deletions(-) diff --git a/connectors/github/element-templates/github-connector.json b/connectors/github/element-templates/github-connector.json index d94a574d57..6610bc34f3 100644 --- a/connectors/github/element-templates/github-connector.json +++ b/connectors/github/element-templates/github-connector.json @@ -87,6 +87,10 @@ { "name": "References", "value": "references" + }, + { + "name": "Pulls", + "value": "pulls" } ], "binding": { @@ -323,6 +327,29 @@ "name": "operationType" } }, + { + "label": "Operation type", + "id": "operationType", + "group": "operation", + "type": "Dropdown", + "value": "createPullRequest", + "choices": [ + { + "name": "Create a pull request", + "value": "createPullRequest" + } + ], + "condition": { + "property": "operationGroup", + "oneOf": [ + "pulls" + ] + }, + "binding": { + "type": "zeebe:input", + "name": "operationType" + } + }, { "type": "Hidden", "label": "Type", @@ -371,7 +398,8 @@ "orgInvitation", "createIssueComment", "createWorkflowDispatchEvent", - "createReference" + "createReference", + "createPullRequest" ] } }, @@ -471,7 +499,8 @@ "listAlertsForRepo", "listCommits", "createWorkflowDispatchEvent", - "createReference" + "createReference", + "createPullRequest" ] } }, @@ -510,7 +539,8 @@ "listAlertsForRepo", "listCommits", "createWorkflowDispatchEvent", - "createReference" + "createReference", + "createPullRequest" ] } }, @@ -1322,6 +1352,103 @@ ] } }, + { + "label": "Title", + "description": "The title of the new pull request", + "group": "input", + "type": "String", + "feel": "optional", + "value": "", + "binding": { + "type": "zeebe:input", + "name": "title" + }, + "constraints": { + "notEmpty": true + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + } + }, + { + "label": "Head", + "description": "The name of the branch where your changes are implemented", + "group": "input", + "type": "String", + "feel": "optional", + "value": "", + "binding": { + "type": "zeebe:input", + "name": "head" + }, + "constraints": { + "notEmpty": true + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + } + }, + { + "label": "Base", + "description": "The name of the branch you want the changes pulled into", + "group": "input", + "type": "String", + "feel": "optional", + "value": "", + "binding": { + "type": "zeebe:input", + "name": "base" + }, + "constraints": { + "notEmpty": true + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + } + }, + { + "label": "Body", + "description": "The contents of the pull request", + "group": "input", + "type": "String", + "feel": "optional", + "value": "", + "binding": { + "type": "zeebe:input", + "name": "prBody" + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + } + }, + { + "label": "Draft", + "description": "Indicates whether the pull request is a draft", + "group": "input", + "type": "Boolean", + "binding": { + "type": "zeebe:input", + "name": "draft" + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + } + }, { "group": "configuration", "type": "Hidden", @@ -1449,6 +1576,22 @@ }, "optional": true }, + { + "group": "input", + "type": "Hidden", + "value": "={\"title\": if title = null then null else title, \"head\": if head = null then null else head, \"base\": if base = null then null else base, \"body\": if prBody = null then null else prBody, \"draft\": draft}", + "binding": { + "type": "zeebe:input", + "name": "body" + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + }, + "optional": true + }, { "group": "input", "type": "Hidden", @@ -1774,6 +1917,44 @@ ] } }, + { + "label": "Result expression", + "id": "resultCreateReference", + "description": "Expression to map the response into process variables. Details in the documentation", + "group": "output", + "type": "String", + "feel": "required", + "value": "={createdReference: response.body}", + "binding": { + "type": "zeebe:taskHeader", + "key": "resultExpression" + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createReference" + ] + } + }, + { + "label": "Result expression", + "id": "resultCreatePullRequest", + "description": "Expression to map the response into process variables. Details in the documentation", + "group": "output", + "type": "String", + "feel": "required", + "value": "={createdPullRequest: response.body}", + "binding": { + "type": "zeebe:taskHeader", + "key": "resultExpression" + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + } + }, { "label": "Connection timeout", "description": "Sets the timeout in seconds to establish a connection or 0 for an infinite timeout", @@ -2074,6 +2255,20 @@ ] } }, + { + "type": "Hidden", + "value": "=baseUrl + \"/repos/\" + owner + \"/\" + repo + \"/pulls\"", + "binding": { + "type": "zeebe:input", + "name": "url" + }, + "condition": { + "property": "operationType", + "oneOf": [ + "createPullRequest" + ] + } + }, { "label": "Error expression", "description": "Expression to handle errors. Details in the documentation",