n8n-nodes-github-copilot 1.0.9 → 1.1.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.
|
@@ -72,6 +72,25 @@ class GitHubCopilot {
|
|
|
72
72
|
},
|
|
73
73
|
],
|
|
74
74
|
properties: [
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Authentication Type',
|
|
77
|
+
name: 'authType',
|
|
78
|
+
type: 'options',
|
|
79
|
+
options: [
|
|
80
|
+
{
|
|
81
|
+
name: 'OAuth2 (Automatic)',
|
|
82
|
+
value: 'oauth2',
|
|
83
|
+
description: 'Use OAuth2 authentication configured in n8n',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'Manual Token',
|
|
87
|
+
value: 'manual',
|
|
88
|
+
description: 'Use manually entered GitHub token',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
default: 'manual',
|
|
92
|
+
description: 'Choose how to authenticate with GitHub',
|
|
93
|
+
},
|
|
75
94
|
{
|
|
76
95
|
displayName: 'Operation',
|
|
77
96
|
name: 'operation',
|
|
@@ -186,23 +205,28 @@ class GitHubCopilot {
|
|
|
186
205
|
const operation = this.getNodeParameter('operation', i);
|
|
187
206
|
const prompt = this.getNodeParameter('prompt', i);
|
|
188
207
|
const context = this.getNodeParameter('context', i, '');
|
|
189
|
-
|
|
208
|
+
const authType = this.getNodeParameter('authType', i);
|
|
190
209
|
let accessToken;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
credentials = await this.getCredentials('gitHubApiManual');
|
|
198
|
-
accessToken = credentials.accessToken;
|
|
210
|
+
let credentialType = '';
|
|
211
|
+
if (authType === 'oauth2') {
|
|
212
|
+
const oauthCredentials = await this.getCredentials('gitHubApi');
|
|
213
|
+
if ((oauthCredentials === null || oauthCredentials === void 0 ? void 0 : oauthCredentials.accessToken) && typeof oauthCredentials.accessToken === 'string') {
|
|
214
|
+
accessToken = oauthCredentials.accessToken;
|
|
215
|
+
credentialType = 'OAuth2';
|
|
199
216
|
}
|
|
200
|
-
|
|
201
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), '
|
|
217
|
+
else {
|
|
218
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'OAuth2 credentials not found or invalid. Please configure OAuth2 authentication or switch to Manual Token.');
|
|
202
219
|
}
|
|
203
220
|
}
|
|
204
|
-
|
|
205
|
-
|
|
221
|
+
else {
|
|
222
|
+
const manualCredentials = await this.getCredentials('gitHubApiManual');
|
|
223
|
+
if ((manualCredentials === null || manualCredentials === void 0 ? void 0 : manualCredentials.accessToken) && typeof manualCredentials.accessToken === 'string') {
|
|
224
|
+
accessToken = manualCredentials.accessToken;
|
|
225
|
+
credentialType = 'Manual Token';
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Manual token credentials not found or invalid. Please configure Manual Token authentication or switch to OAuth2.');
|
|
229
|
+
}
|
|
206
230
|
}
|
|
207
231
|
let command;
|
|
208
232
|
let fullPrompt = prompt;
|
|
@@ -248,6 +272,8 @@ class GitHubCopilot {
|
|
|
248
272
|
env: {
|
|
249
273
|
...process.env,
|
|
250
274
|
GH_TOKEN: accessToken,
|
|
275
|
+
GITHUB_TOKEN: accessToken,
|
|
276
|
+
GH_PAT: accessToken,
|
|
251
277
|
HOME: '/opt/n8n-source/packages/cli/bin',
|
|
252
278
|
},
|
|
253
279
|
timeout: 30000,
|
|
@@ -266,6 +292,9 @@ class GitHubCopilot {
|
|
|
266
292
|
operation,
|
|
267
293
|
prompt: prompt,
|
|
268
294
|
context: context || undefined,
|
|
295
|
+
authType: authType,
|
|
296
|
+
credentialType: credentialType,
|
|
297
|
+
tokenPrefix: accessToken ? accessToken.substring(0, 4) + '...' : 'none',
|
|
269
298
|
language: operation === 'suggest' ? this.getNodeParameter('language', i) : undefined,
|
|
270
299
|
commandType: operation === 'shell' ? this.getNodeParameter('commandType', i) : undefined,
|
|
271
300
|
output: processedOutput,
|
package/package.json
CHANGED