mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
⚡ Improvements
This commit is contained in:
parent
6f51657ef8
commit
c4332634eb
|
@ -8,7 +8,7 @@ export class CircleCiApi implements ICredentialType {
|
||||||
displayName = 'CircleCI API';
|
displayName = 'CircleCI API';
|
||||||
properties = [
|
properties = [
|
||||||
{
|
{
|
||||||
displayName: 'API Key',
|
displayName: 'Personal API Token',
|
||||||
name: 'apiKey',
|
name: 'apiKey',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
|
|
|
@ -71,16 +71,18 @@ export class CircleCi implements INodeType {
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
if (resource === 'pipeline') {
|
if (resource === 'pipeline') {
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
|
const vcs = this.getNodeParameter('vcs', i) as string;
|
||||||
let slug = this.getNodeParameter('projectSlug', i) as string;
|
let slug = this.getNodeParameter('projectSlug', i) as string;
|
||||||
const pipelineNumber = this.getNodeParameter('pipelineNumber', i) as number;
|
const pipelineNumber = this.getNodeParameter('pipelineNumber', i) as number;
|
||||||
|
|
||||||
slug = slug.replace(new RegExp(/\//g), '%2F');
|
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);
|
responseData = await circleciApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||||
}
|
}
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
|
const vcs = this.getNodeParameter('vcs', i) as string;
|
||||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
let slug = this.getNodeParameter('projectSlug', i) as string;
|
let slug = this.getNodeParameter('projectSlug', i) as string;
|
||||||
|
@ -91,7 +93,7 @@ export class CircleCi implements INodeType {
|
||||||
qs.branch = filters.branch;
|
qs.branch = filters.branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
const endpoint = `/project/${slug}/pipeline`;
|
const endpoint = `/project/${vcs}/${slug}/pipeline`;
|
||||||
|
|
||||||
if (returnAll === true) {
|
if (returnAll === true) {
|
||||||
responseData = await circleciApiRequestAllItems.call(this, 'items', 'GET', endpoint, {}, qs);
|
responseData = await circleciApiRequestAllItems.call(this, 'items', 'GET', endpoint, {}, qs);
|
||||||
|
@ -105,13 +107,14 @@ export class CircleCi implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'trigger') {
|
if (operation === 'trigger') {
|
||||||
|
const vcs = this.getNodeParameter('vcs', i) as string;
|
||||||
let slug = this.getNodeParameter('projectSlug', i) as string;
|
let slug = this.getNodeParameter('projectSlug', i) as string;
|
||||||
|
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
slug = slug.replace(new RegExp(/\//g), '%2F');
|
slug = slug.replace(new RegExp(/\//g), '%2F');
|
||||||
|
|
||||||
const endpoint = `/project/${slug}/pipeline`;
|
const endpoint = `/project/${vcs}/${slug}/pipeline`;
|
||||||
|
|
||||||
const body: IDataObject = {};
|
const body: IDataObject = {};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,33 @@ export const pipelineFields = [
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* pipeline:get */
|
/* 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',
|
displayName: 'Project Slug',
|
||||||
name: 'projectSlug',
|
name: 'projectSlug',
|
||||||
|
@ -56,12 +83,15 @@ export const pipelineFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: '',
|
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',
|
displayName: 'Pipeline Number',
|
||||||
name: 'pipelineNumber',
|
name: 'pipelineNumber',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 1,
|
||||||
|
},
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
operation: [
|
operation: [
|
||||||
|
@ -72,12 +102,39 @@ export const pipelineFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: 0,
|
default: 1,
|
||||||
description: 'The number of the pipeline',
|
description: 'The number of the pipeline',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* pipeline:getAll */
|
/* 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',
|
displayName: 'Project Slug',
|
||||||
name: 'projectSlug',
|
name: 'projectSlug',
|
||||||
|
@ -93,7 +150,7 @@ export const pipelineFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: '',
|
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',
|
displayName: 'Return All',
|
||||||
|
@ -165,6 +222,33 @@ export const pipelineFields = [
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* pipeline:trigger */
|
/* 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',
|
displayName: 'Project Slug',
|
||||||
name: 'projectSlug',
|
name: 'projectSlug',
|
||||||
|
@ -180,7 +264,7 @@ export const pipelineFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: '',
|
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',
|
displayName: 'Additional Fields',
|
||||||
|
|
Loading…
Reference in a new issue