diff --git a/packages/nodes-base/credentials/CircleCiApi.credentials.ts b/packages/nodes-base/credentials/CircleCiApi.credentials.ts index 88ecdc4fe1..ef3104b5e6 100644 --- a/packages/nodes-base/credentials/CircleCiApi.credentials.ts +++ b/packages/nodes-base/credentials/CircleCiApi.credentials.ts @@ -8,7 +8,7 @@ export class CircleCiApi implements ICredentialType { displayName = 'CircleCI API'; properties = [ { - displayName: 'API Key', + displayName: 'Personal API Token', name: 'apiKey', type: 'string' as NodePropertyTypes, default: '', diff --git a/packages/nodes-base/nodes/CircleCi/CircleCi.node.ts b/packages/nodes-base/nodes/CircleCi/CircleCi.node.ts index 00eded6366..a15a9511e2 100644 --- a/packages/nodes-base/nodes/CircleCi/CircleCi.node.ts +++ b/packages/nodes-base/nodes/CircleCi/CircleCi.node.ts @@ -71,16 +71,18 @@ export class CircleCi implements INodeType { for (let i = 0; i < length; i++) { if (resource === 'pipeline') { if (operation === 'get') { + const vcs = this.getNodeParameter('vcs', i) as string; let slug = this.getNodeParameter('projectSlug', i) as string; const pipelineNumber = this.getNodeParameter('pipelineNumber', i) as number; slug = slug.replace(new RegExp(/\//g), '%2F'); - const endpoint = `/project/${slug}/pipeline/${pipelineNumber}`; + const endpoint = `/project/${vcs}/${slug}/pipeline/${pipelineNumber}`; responseData = await circleciApiRequest.call(this, 'GET', endpoint, {}, qs); } if (operation === 'getAll') { + const vcs = this.getNodeParameter('vcs', i) as string; const filters = this.getNodeParameter('filters', i) as IDataObject; const returnAll = this.getNodeParameter('returnAll', i) as boolean; let slug = this.getNodeParameter('projectSlug', i) as string; @@ -91,7 +93,7 @@ export class CircleCi implements INodeType { qs.branch = filters.branch; } - const endpoint = `/project/${slug}/pipeline`; + const endpoint = `/project/${vcs}/${slug}/pipeline`; if (returnAll === true) { responseData = await circleciApiRequestAllItems.call(this, 'items', 'GET', endpoint, {}, qs); @@ -105,13 +107,14 @@ export class CircleCi implements INodeType { } if (operation === 'trigger') { + const vcs = this.getNodeParameter('vcs', i) as string; let slug = this.getNodeParameter('projectSlug', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; slug = slug.replace(new RegExp(/\//g), '%2F'); - const endpoint = `/project/${slug}/pipeline`; + const endpoint = `/project/${vcs}/${slug}/pipeline`; const body: IDataObject = {}; diff --git a/packages/nodes-base/nodes/CircleCi/PipelineDescription.ts b/packages/nodes-base/nodes/CircleCi/PipelineDescription.ts index 66b99f3eb3..4ffd2183d6 100644 --- a/packages/nodes-base/nodes/CircleCi/PipelineDescription.ts +++ b/packages/nodes-base/nodes/CircleCi/PipelineDescription.ts @@ -41,6 +41,33 @@ export const pipelineFields = [ /* -------------------------------------------------------------------------- */ /* pipeline:get */ /* -------------------------------------------------------------------------- */ + { + displayName: 'VCS', + name: 'vcs', + type: 'options', + options: [ + { + name: 'Github', + value: 'github', + }, + { + name: 'Bitbucket', + value: 'bitbucket', + }, + ], + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'pipeline', + ], + }, + }, + default: '', + description: 'Version control system', + }, { displayName: 'Project Slug', name: 'projectSlug', @@ -56,12 +83,15 @@ export const pipelineFields = [ }, }, default: '', - description: 'Project slug in the form vcs-slug/org-name/repo-name', + description: 'Project slug in the form org-name/repo-name', }, { displayName: 'Pipeline Number', name: 'pipelineNumber', type: 'number', + typeOptions: { + minValue: 1, + }, displayOptions: { show: { operation: [ @@ -72,12 +102,39 @@ export const pipelineFields = [ ], }, }, - default: 0, + default: 1, description: 'The number of the pipeline', }, /* -------------------------------------------------------------------------- */ /* pipeline:getAll */ /* -------------------------------------------------------------------------- */ + { + displayName: 'VCS', + name: 'vcs', + type: 'options', + options: [ + { + name: 'Github', + value: 'github', + }, + { + name: 'Bitbucket', + value: 'bitbucket', + }, + ], + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'pipeline', + ], + }, + }, + default: '', + description: 'Version control system', + }, { displayName: 'Project Slug', name: 'projectSlug', @@ -93,7 +150,7 @@ export const pipelineFields = [ }, }, default: '', - description: 'Project slug in the form vcs-slug/org-name/repo-name', + description: 'Project slug in the form org-name/repo-name', }, { displayName: 'Return All', @@ -165,6 +222,33 @@ export const pipelineFields = [ /* -------------------------------------------------------------------------- */ /* pipeline:trigger */ /* -------------------------------------------------------------------------- */ + { + displayName: 'VCS', + name: 'vcs', + type: 'options', + options: [ + { + name: 'Github', + value: 'github', + }, + { + name: 'Bitbucket', + value: 'bitbucket', + }, + ], + displayOptions: { + show: { + operation: [ + 'trigger', + ], + resource: [ + 'pipeline', + ], + }, + }, + default: '', + description: 'Version control system', + }, { displayName: 'Project Slug', name: 'projectSlug', @@ -180,7 +264,7 @@ export const pipelineFields = [ }, }, default: '', - description: 'Project slug in the form vcs-slug/org-name/repo-name', + description: 'Project slug in the form org-name/repo-name', }, { displayName: 'Additional Fields',