mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
⚡ Minor improvements to TravisCi-Node
This commit is contained in:
parent
3dfa55d850
commit
26f3f949aa
|
@ -48,9 +48,9 @@ export const buildOperations = [
|
||||||
|
|
||||||
export const buildFields = [
|
export const buildFields = [
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* build:cancel */
|
/* build:cancel */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Build ID',
|
displayName: 'Build ID',
|
||||||
name: 'buildId',
|
name: 'buildId',
|
||||||
|
@ -68,9 +68,10 @@ export const buildFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Value uniquely identifying the build.',
|
description: 'Value uniquely identifying the build.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* build:get */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* build:get */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Build ID',
|
displayName: 'Build ID',
|
||||||
name: 'buildId',
|
name: 'buildId',
|
||||||
|
@ -115,9 +116,10 @@ export const buildFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* build:getAll */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* build:getAll */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Return All',
|
displayName: 'Return All',
|
||||||
name: 'returnAll',
|
name: 'returnAll',
|
||||||
|
@ -235,9 +237,10 @@ export const buildFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* build:restart */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* build:restart */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Build ID',
|
displayName: 'Build ID',
|
||||||
name: 'buildId',
|
name: 'buildId',
|
||||||
|
@ -255,9 +258,10 @@ export const buildFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Value uniquely identifying the build.',
|
description: 'Value uniquely identifying the build.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* build:trigger */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* build:trigger */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Slug',
|
displayName: 'Slug',
|
||||||
name: 'slug',
|
name: 'slug',
|
||||||
|
@ -272,6 +276,7 @@ export const buildFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
placeholder: 'n8n-io/n8n',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Same as {ownerName}/{repositoryName}',
|
description: 'Same as {ownerName}/{repositoryName}',
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,9 +15,9 @@ import {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
get,
|
get,
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
|
|
||||||
import * as querystring from 'querystring';
|
import * as querystring from 'querystring';
|
||||||
|
|
||||||
export async function travisciApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function travisciApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credentials = this.getCredentials('travisCiApi');
|
const credentials = this.getCredentials('travisCiApi');
|
||||||
|
@ -34,7 +34,7 @@ export async function travisciApiRequest(this: IHookFunctions | IExecuteFunction
|
||||||
method,
|
method,
|
||||||
qs,
|
qs,
|
||||||
body,
|
body,
|
||||||
uri: uri ||`https://api.travis-ci.com${resource}`,
|
uri: uri || `https://api.travis-ci.com${resource}`,
|
||||||
json: true
|
json: true
|
||||||
};
|
};
|
||||||
options = Object.assign({}, options, option);
|
options = Object.assign({}, options, option);
|
||||||
|
@ -58,7 +58,7 @@ export async function travisciApiRequest(this: IHookFunctions | IExecuteFunction
|
||||||
* Make an API request to paginated TravisCI endpoint
|
* Make an API request to paginated TravisCI endpoint
|
||||||
* and return all results
|
* and return all results
|
||||||
*/
|
*/
|
||||||
export async function travisciApiRequestAllItems(this: IHookFunctions | IExecuteFunctions| ILoadOptionsFunctions, propertyName: string, method: string, resource: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function travisciApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, resource: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,14 @@ export class TravisCi implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'TravisCI',
|
displayName: 'TravisCI',
|
||||||
name: 'travisCi',
|
name: 'travisCi',
|
||||||
icon: 'file:travisCi.png',
|
icon: 'file:travisci.png',
|
||||||
group: ['output'],
|
group: ['output'],
|
||||||
version: 1,
|
version: 1,
|
||||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||||
description: 'Consume TravisCI API',
|
description: 'Consume TravisCI API',
|
||||||
defaults: {
|
defaults: {
|
||||||
name: 'TravisCI',
|
name: 'TravisCI',
|
||||||
color: '#FF0000',
|
color: '#666666',
|
||||||
},
|
},
|
||||||
inputs: ['main'],
|
inputs: ['main'],
|
||||||
outputs: ['main'],
|
outputs: ['main'],
|
||||||
|
@ -126,7 +126,7 @@ export class TravisCi implements INodeType {
|
||||||
slug = slug.replace(new RegExp(/\//g), '%2F');
|
slug = slug.replace(new RegExp(/\//g), '%2F');
|
||||||
|
|
||||||
const request: IDataObject = {
|
const request: IDataObject = {
|
||||||
branch,
|
branch,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (additionalFields.message) {
|
if (additionalFields.message) {
|
||||||
|
@ -137,7 +137,7 @@ export class TravisCi implements INodeType {
|
||||||
request.merge_mode = additionalFields.mergeMode as string;
|
request.merge_mode = additionalFields.mergeMode as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData = await travisciApiRequest.call(this, 'POST', `/repo/${slug}/requests`, JSON.stringify({request}));
|
responseData = await travisciApiRequest.call(this, 'POST', `/repo/${slug}/requests`, JSON.stringify({ request }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData)) {
|
if (Array.isArray(responseData)) {
|
||||||
|
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Loading…
Reference in a new issue