mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
IT WORKS!
This commit is contained in:
parent
8345c46c91
commit
a09650116a
|
@ -125,24 +125,29 @@ export class Github implements INodeType {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// operations
|
// operations
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
{
|
|
||||||
|
{
|
||||||
displayName: 'Operation',
|
displayName: 'Operation',
|
||||||
name: 'operation',
|
name: 'operation',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: [
|
resource: [
|
||||||
'organization',
|
'organization',
|
||||||
],
|
],
|
||||||
},
|
|
||||||
|
},
|
||||||
},
|
},
|
||||||
options: [{
|
options: [
|
||||||
name: 'getOrgRepositories',
|
{
|
||||||
value: 'getOrgRepositories',
|
name: 'Get all Repositories',
|
||||||
description: 'Get all repositories of an organization',}],
|
value: 'getAll',
|
||||||
default: 'getOrgRepositories',
|
description: 'Returns all repositories of an organization',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'getAll',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
displayName: 'Operation',
|
displayName: 'Operation',
|
||||||
|
@ -389,7 +394,7 @@ export class Github implements INodeType {
|
||||||
name: 'owner',
|
name: 'owner',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
required: true,
|
required: false,
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
hide: {
|
hide: {
|
||||||
operation: [
|
operation: [
|
||||||
|
@ -405,7 +410,7 @@ export class Github implements INodeType {
|
||||||
name: 'repository',
|
name: 'repository',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
required: true,
|
required: false,
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
hide: {
|
hide: {
|
||||||
resource: [
|
resource: [
|
||||||
|
@ -1744,52 +1749,6 @@ export class Github implements INodeType {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------------------------------
|
|
||||||
// Org:getOrgRepositories
|
|
||||||
// ----------------------------------
|
|
||||||
{
|
|
||||||
displayName: 'get Org Repositories',
|
|
||||||
name: 'getOrgRepositories',
|
|
||||||
type: 'boolean',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'organisation',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getOrgRepositories',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default: true,
|
|
||||||
description: 'If all results should be returned or only up to a given limit.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Limit',
|
|
||||||
name: 'limit',
|
|
||||||
type: 'number',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'user',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getOrgRepositories',
|
|
||||||
],
|
|
||||||
returnAll: [
|
|
||||||
false,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
typeOptions: {
|
|
||||||
minValue: 1,
|
|
||||||
maxValue: 100,
|
|
||||||
},
|
|
||||||
default: 50,
|
|
||||||
description: 'How many results to return.',
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// user:invite
|
// user:invite
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -1910,6 +1869,7 @@ export class Github implements INodeType {
|
||||||
'user:getRepositories',
|
'user:getRepositories',
|
||||||
'release:getAll',
|
'release:getAll',
|
||||||
'review:getAll',
|
'review:getAll',
|
||||||
|
'organization:getAll',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@ -1940,7 +1900,7 @@ export class Github implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
let repository = '';
|
let repository = '';
|
||||||
if (fullOperation !== 'user:getRepositories' && fullOperation !== 'user:invite') {
|
if (fullOperation !== 'user:getRepositories' && fullOperation !== 'user:invite' && fullOperation !== 'organization:getAll') {
|
||||||
repository = this.getNodeParameter('repository', i) as string;
|
repository = this.getNodeParameter('repository', i) as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1997,6 +1957,7 @@ export class Github implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
|
endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
|
||||||
|
|
||||||
} else if (operation === 'delete') {
|
} else if (operation === 'delete') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// delete
|
// delete
|
||||||
|
@ -2301,12 +2262,36 @@ export class Github implements INodeType {
|
||||||
// invite
|
// invite
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
|
|
||||||
requestMethod = 'POST';
|
requestMethod = 'POST';
|
||||||
const org = this.getNodeParameter('organization', i) as string;
|
const org = this.getNodeParameter('organization', i) as string;
|
||||||
endpoint = `/orgs/${org}/invitations`;
|
endpoint = `/orgs/${org}/invitations`;
|
||||||
body.email = this.getNodeParameter('email', i) as string;
|
body.email = this.getNodeParameter('email', i) as string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else if (resource === 'organization') {
|
||||||
|
if (operation === 'getAll') {
|
||||||
|
// ----------------------------------
|
||||||
|
// getRepositories
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
requestMethod = 'GET';
|
||||||
|
|
||||||
|
endpoint = `/orgs/${owner}/repos`;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (operation === 'invite') {
|
||||||
|
// ----------------------------------
|
||||||
|
// invite
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
requestMethod = 'POST';
|
||||||
|
const org = this.getNodeParameter('organization', i) as string;
|
||||||
|
endpoint = `/orgs/${org}/invitations`;
|
||||||
|
body.email = this.getNodeParameter('email', i) as string;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`);
|
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`);
|
||||||
|
|
Loading…
Reference in a new issue