n8n-nodes-github-copilot 3.15.1 → 3.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- import { ICredentialType, INodeProperties, ICredentialTestRequest } from 'n8n-workflow';
1
+ import { ICredentialType, INodeProperties, ICredentialTestRequest, IAuthenticateGeneric } from 'n8n-workflow';
2
2
  export declare class GitHubCopilotApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
- extends: string[];
6
5
  documentationUrl: string;
7
6
  properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
8
  test: ICredentialTestRequest;
9
9
  }
@@ -4,75 +4,44 @@ exports.GitHubCopilotApi = void 0;
4
4
  class GitHubCopilotApi {
5
5
  constructor() {
6
6
  this.name = 'githubCopilotApi';
7
- this.displayName = 'GitHub Copilot API (OAuth)';
8
- this.extends = ['oAuth2Api'];
7
+ this.displayName = 'GitHub Copilot API (GitHub CLI Token)';
9
8
  this.documentationUrl = 'https://docs.github.com/en/copilot/github-copilot-chat/copilot-chat-in-ides/using-github-copilot-chat-in-your-ide';
10
9
  this.properties = [
11
10
  {
12
- displayName: 'Grant Type',
13
- name: 'grantType',
14
- type: 'hidden',
15
- default: 'authorizationCode',
16
- },
17
- {
18
- displayName: 'Client ID',
19
- name: 'clientId',
20
- type: 'string',
11
+ displayName: '⚠️ IMPORTANT: GitHub CLI Token Required',
12
+ name: 'notice',
13
+ type: 'notice',
21
14
  default: '',
22
- required: true,
23
- description: 'The Client ID of your GitHub OAuth App configured for GitHub Copilot API access',
24
- placeholder: 'e.g., Iv1.a1b2c3d4e5f6g7h8',
15
+ description: 'Only tokens generated by GitHub CLI work with Copilot API. OAuth2 and Personal Access Tokens from GitHub website DO NOT work.',
25
16
  },
26
17
  {
27
- displayName: 'Client Secret',
28
- name: 'clientSecret',
18
+ displayName: 'GitHub CLI Token',
19
+ name: 'token',
29
20
  type: 'string',
30
- typeOptions: { password: true },
21
+ typeOptions: {
22
+ password: true,
23
+ },
31
24
  default: '',
32
25
  required: true,
33
- description: 'The Client Secret of your GitHub OAuth App',
34
- placeholder: 'Your OAuth App Client Secret',
35
- },
36
- {
37
- displayName: 'Authorization URL',
38
- name: 'authUrl',
39
- type: 'hidden',
40
- default: 'https://github.com/login/oauth/authorize',
41
- },
42
- {
43
- displayName: 'Access Token URL',
44
- name: 'accessTokenUrl',
45
- type: 'hidden',
46
- default: 'https://github.com/login/oauth/access_token',
47
- },
48
- {
49
- displayName: 'Scope',
50
- name: 'scope',
51
- type: 'hidden',
52
- default: 'repo read:org gist',
53
- },
54
- {
55
- displayName: 'Auth URI Query Parameters',
56
- name: 'authQueryParameters',
57
- type: 'hidden',
58
- default: '',
59
- },
60
- {
61
- displayName: 'Authentication',
62
- name: 'authentication',
63
- type: 'hidden',
64
- default: 'header',
26
+ description: '⚠️ REQUIRED: Token generated by GitHub CLI that starts with "gho_". Get it by running: gh auth login && gh auth token. Other tokens will NOT work!',
27
+ placeholder: 'gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
65
28
  },
66
29
  ];
30
+ this.authenticate = {
31
+ type: 'generic',
32
+ properties: {
33
+ headers: {
34
+ 'Authorization': '=Bearer {{$credentials.token}}',
35
+ 'Accept': 'application/json',
36
+ 'Content-Type': 'application/json',
37
+ },
38
+ },
39
+ };
67
40
  this.test = {
68
41
  request: {
69
42
  baseURL: 'https://api.githubcopilot.com',
70
43
  url: '/models',
71
44
  method: 'GET',
72
- headers: {
73
- 'Accept': 'application/json',
74
- 'Content-Type': 'application/json',
75
- },
76
45
  },
77
46
  };
78
47
  }
@@ -110,15 +110,6 @@ class GitHubCopilot {
110
110
  placeholder: 'Enter your request...',
111
111
  description: 'What you want GitHub Copilot to help with',
112
112
  },
113
- {
114
- displayName: 'GitHub Token (Optional)',
115
- name: 'githubToken',
116
- type: 'string',
117
- typeOptions: { password: true },
118
- default: '',
119
- placeholder: 'gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
120
- description: '⚠️ IMPORTANT: Only tokens generated by GitHub CLI itself work with Copilot. Personal Access Tokens from GitHub website DO NOT work. If not provided, will use local "gh auth login" authentication. To get a working token, use: gh auth token',
121
- },
122
113
  {
123
114
  displayName: 'Filter Output',
124
115
  name: 'filterOutput',
@@ -194,9 +185,19 @@ class GitHubCopilot {
194
185
  const operation = this.getNodeParameter('operation', i);
195
186
  const prompt = this.getNodeParameter('prompt', i);
196
187
  const context = this.getNodeParameter('context', i, '');
197
- const githubToken = this.getNodeParameter('githubToken', i, '');
188
+ let githubToken = '';
189
+ let authMethod = 'Local CLI';
190
+ try {
191
+ const credentials = await this.getCredentials('githubCopilotApi');
192
+ if (credentials && credentials.token) {
193
+ githubToken = credentials.token;
194
+ authMethod = 'GitHub Copilot Credential';
195
+ }
196
+ }
197
+ catch (error) {
198
+ console.log('No GitHub Copilot credential configured, using local CLI auth');
199
+ }
198
200
  const useToken = githubToken && githubToken.trim() !== '';
199
- const authMethod = useToken ? 'Manual Token' : 'Local CLI';
200
201
  let command;
201
202
  let fullPrompt = prompt;
202
203
  if (context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.15.1",
3
+ "version": "3.17.0",
4
4
  "description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",