diff --git a/packages/nodes-base/credentials/GithubApi.credentials.ts b/packages/nodes-base/credentials/GithubApi.credentials.ts index 9bd3ebcee..94f6fad69 100644 --- a/packages/nodes-base/credentials/GithubApi.credentials.ts +++ b/packages/nodes-base/credentials/GithubApi.credentials.ts @@ -3,11 +3,17 @@ import { NodePropertyTypes, } from 'n8n-workflow'; - export class GithubApi implements ICredentialType { name = 'githubApi'; displayName = 'Github API'; 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', name: 'user', diff --git a/packages/nodes-base/nodes/Github/GenericFunctions.ts b/packages/nodes-base/nodes/Github/GenericFunctions.ts index 0b4c8452a..0e20be93f 100644 --- a/packages/nodes-base/nodes/Github/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Github/GenericFunctions.ts @@ -21,6 +21,7 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions, if (credentials === undefined) { throw new Error('No credentials got returned!'); } + const baseUrl = credentials!.server || 'https://api.github.com'; const options = { method, @@ -30,7 +31,7 @@ export async function githubApiRequest(this: IHookFunctions | IExecuteFunctions, }, body, qs: query, - uri: `https://api.github.com${endpoint}`, + uri: `${baseUrl}${endpoint}`, json: true };