Minor improvements to TravisCi-Node

This commit is contained in:
Jan Oberhauser 2020-08-04 15:53:34 +02:00
parent 3dfa55d850
commit 26f3f949aa
4 changed files with 28 additions and 23 deletions

View file

@ -48,9 +48,9 @@ export const buildOperations = [
export const buildFields = [
/* -------------------------------------------------------------------------- */
/* build:cancel */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* build:cancel */
/* -------------------------------------------------------------------------- */
{
displayName: 'Build ID',
name: 'buildId',
@ -68,9 +68,10 @@ export const buildFields = [
default: '',
description: 'Value uniquely identifying the build.',
},
/* -------------------------------------------------------------------------- */
/* build:get */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* build:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Build ID',
name: 'buildId',
@ -115,9 +116,10 @@ export const buildFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* build:getAll */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* build:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
@ -235,9 +237,10 @@ export const buildFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* build:restart */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* build:restart */
/* -------------------------------------------------------------------------- */
{
displayName: 'Build ID',
name: 'buildId',
@ -255,9 +258,10 @@ export const buildFields = [
default: '',
description: 'Value uniquely identifying the build.',
},
/* -------------------------------------------------------------------------- */
/* build:trigger */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* build:trigger */
/* -------------------------------------------------------------------------- */
{
displayName: 'Slug',
name: 'slug',
@ -272,6 +276,7 @@ export const buildFields = [
],
},
},
placeholder: 'n8n-io/n8n',
default: '',
description: 'Same as {ownerName}/{repositoryName}',
},

View file

@ -15,9 +15,9 @@ import {
import {
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
const credentials = this.getCredentials('travisCiApi');
@ -34,7 +34,7 @@ export async function travisciApiRequest(this: IHookFunctions | IExecuteFunction
method,
qs,
body,
uri: uri ||`https://api.travis-ci.com${resource}`,
uri: uri || `https://api.travis-ci.com${resource}`,
json: true
};
options = Object.assign({}, options, option);
@ -58,7 +58,7 @@ export async function travisciApiRequest(this: IHookFunctions | IExecuteFunction
* Make an API request to paginated TravisCI endpoint
* 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[] = [];

View file

@ -23,14 +23,14 @@ export class TravisCi implements INodeType {
description: INodeTypeDescription = {
displayName: 'TravisCI',
name: 'travisCi',
icon: 'file:travisCi.png',
icon: 'file:travisci.png',
group: ['output'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume TravisCI API',
defaults: {
name: 'TravisCI',
color: '#FF0000',
color: '#666666',
},
inputs: ['main'],
outputs: ['main'],
@ -126,7 +126,7 @@ export class TravisCi implements INodeType {
slug = slug.replace(new RegExp(/\//g), '%2F');
const request: IDataObject = {
branch,
branch,
};
if (additionalFields.message) {
@ -137,7 +137,7 @@ export class TravisCi implements INodeType {
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)) {

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB