n8n-nodes-github-copilot 1.1.3 → 1.1.5

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.
@@ -87,6 +87,11 @@ class GitHubCopilot {
87
87
  name: 'authType',
88
88
  type: 'options',
89
89
  options: [
90
+ {
91
+ name: 'Local CLI Authentication',
92
+ value: 'local',
93
+ description: 'Use GitHub CLI local authentication (recommended)',
94
+ },
90
95
  {
91
96
  name: 'OAuth2 (Automatic)',
92
97
  value: 'oauth2',
@@ -98,7 +103,7 @@ class GitHubCopilot {
98
103
  description: 'Use manually entered GitHub token',
99
104
  },
100
105
  ],
101
- default: 'manual',
106
+ default: 'local',
102
107
  description: 'Choose how to authenticate with GitHub',
103
108
  },
104
109
  {
@@ -208,7 +213,6 @@ class GitHubCopilot {
208
213
  };
209
214
  }
210
215
  async execute() {
211
- var _a;
212
216
  const items = this.getInputData();
213
217
  const returnData = [];
214
218
  for (let i = 0; i < items.length; i++) {
@@ -219,19 +223,22 @@ class GitHubCopilot {
219
223
  const authType = this.getNodeParameter('authType', i);
220
224
  let accessToken;
221
225
  let credentialType = '';
222
- if (authType === 'oauth2') {
226
+ if (authType === 'local') {
227
+ credentialType = 'Local CLI';
228
+ accessToken = undefined;
229
+ }
230
+ else if (authType === 'oauth2') {
223
231
  const oauthCredentials = await this.getCredentials('gitHubApi');
224
232
  console.log('OAuth2 credentials object:', JSON.stringify(oauthCredentials, null, 2));
225
233
  const creds = oauthCredentials;
226
- accessToken = (creds === null || creds === void 0 ? void 0 : creds.accessToken) ||
227
- (creds === null || creds === void 0 ? void 0 : creds.access_token) ||
228
- (creds === null || creds === void 0 ? void 0 : creds.token) ||
229
- ((_a = creds === null || creds === void 0 ? void 0 : creds.oauthTokenData) === null || _a === void 0 ? void 0 : _a.access_token);
230
- if (accessToken && typeof accessToken === 'string') {
234
+ const oauthTokenData = creds === null || creds === void 0 ? void 0 : creds.oauthTokenData;
235
+ if ((oauthTokenData === null || oauthTokenData === void 0 ? void 0 : oauthTokenData.access_token) && typeof oauthTokenData.access_token === 'string') {
236
+ accessToken = oauthTokenData.access_token;
231
237
  credentialType = 'OAuth2';
238
+ console.log('Using OAuth2 token from oauthTokenData.access_token:', accessToken.substring(0, 8) + '...');
232
239
  }
233
240
  else {
234
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `OAuth2 token not found. Available fields: ${Object.keys(oauthCredentials || {}).join(', ')}. Please switch to Manual Token.`);
241
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `OAuth2 token not found in oauthTokenData.access_token. Available fields: ${Object.keys(oauthCredentials || {}).join(', ')}. Please switch to Manual Token.`);
235
242
  }
236
243
  }
237
244
  else {
@@ -287,17 +294,23 @@ class GitHubCopilot {
287
294
  default:
288
295
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
289
296
  }
297
+ console.log('Executing command:', command);
298
+ console.log('Auth type:', authType);
299
+ console.log('Token prefix:', accessToken ? accessToken.substring(0, 8) + '...' : 'none (using local CLI auth)');
300
+ console.log('Token type:', accessToken ? (accessToken.startsWith('gho_') ? 'OAuth' : accessToken.startsWith('ghp_') ? 'Classic' : 'Unknown') : 'Local CLI');
290
301
  let stdout = '';
291
302
  let stderr = '';
292
303
  try {
304
+ const envVars = {
305
+ ...process.env,
306
+ HOME: '/opt/n8n-source/packages/cli/bin',
307
+ };
308
+ if (authType !== 'local' && accessToken) {
309
+ envVars.GH_TOKEN = accessToken;
310
+ envVars.GITHUB_TOKEN = accessToken;
311
+ }
293
312
  const result = await execAsync(command, {
294
- env: {
295
- ...process.env,
296
- GH_TOKEN: accessToken,
297
- GITHUB_TOKEN: accessToken,
298
- GH_PAT: accessToken,
299
- HOME: '/opt/n8n-source/packages/cli/bin',
300
- },
313
+ env: envVars,
301
314
  timeout: 30000,
302
315
  maxBuffer: 1024 * 1024,
303
316
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "n8n community node for GitHub Copilot CLI integration",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",