mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
🔀 Merge branch 'RicardoE105-feature/github-enterprise-support'
This commit is contained in:
commit
1e484d5072
|
@ -3,11 +3,17 @@ import {
|
||||||
NodePropertyTypes,
|
NodePropertyTypes,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
|
||||||
export class GithubApi implements ICredentialType {
|
export class GithubApi implements ICredentialType {
|
||||||
name = 'githubApi';
|
name = 'githubApi';
|
||||||
displayName = 'Github API';
|
displayName = 'Github API';
|
||||||
properties = [
|
properties = [
|
||||||
|
{
|
||||||
|
displayName: 'Github Server',
|
||||||
|
name: 'server',
|
||||||
|
type: 'string' as NodePropertyTypes,
|
||||||
|
default: 'https://api.github.com',
|
||||||
|
description: 'The server to connect to. Does only have to get changed if Github Enterprise gets used.',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'User',
|
displayName: 'User',
|
||||||
name: 'user',
|
name: 'user',
|
||||||
|
|
|
@ -21,6 +21,7 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new Error('No credentials got returned!');
|
throw new Error('No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
const baseUrl = credentials!.server || 'https://api.github.com';
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
method,
|
method,
|
||||||
|
@ -30,7 +31,7 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||||
},
|
},
|
||||||
body,
|
body,
|
||||||
qs: query,
|
qs: query,
|
||||||
uri: `https://api.github.com${endpoint}`,
|
uri: `${baseUrl}${endpoint}`,
|
||||||
json: true
|
json: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue