n8n-nodes-github-copilot 3.17.0 → 3.18.1

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.
@@ -65,12 +65,19 @@ class GitHubCopilot {
65
65
  required: false,
66
66
  displayOptions: {
67
67
  show: {
68
- operation: ['suggest', 'explain'],
68
+ useCredential: [true],
69
69
  },
70
70
  },
71
71
  },
72
72
  ],
73
73
  properties: [
74
+ {
75
+ displayName: 'Authentication Method',
76
+ name: 'useCredential',
77
+ type: 'boolean',
78
+ default: false,
79
+ description: 'Use GitHub Copilot API credential instead of local GitHub CLI authentication',
80
+ },
74
81
  {
75
82
  displayName: 'Operation',
76
83
  name: 'operation',
@@ -185,17 +192,20 @@ class GitHubCopilot {
185
192
  const operation = this.getNodeParameter('operation', i);
186
193
  const prompt = this.getNodeParameter('prompt', i);
187
194
  const context = this.getNodeParameter('context', i, '');
195
+ const useCredential = this.getNodeParameter('useCredential', i, false);
188
196
  let githubToken = '';
189
197
  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';
198
+ if (useCredential) {
199
+ try {
200
+ const credentials = await this.getCredentials('githubCopilotApi');
201
+ if (credentials && credentials.token) {
202
+ githubToken = credentials.token;
203
+ authMethod = 'GitHub Copilot Credential';
204
+ }
205
+ }
206
+ catch (error) {
207
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'GitHub Copilot credential is not configured. Please configure it or use Local CLI authentication.');
195
208
  }
196
- }
197
- catch (error) {
198
- console.log('No GitHub Copilot credential configured, using local CLI auth');
199
209
  }
200
210
  const useToken = githubToken && githubToken.trim() !== '';
201
211
  let command;
@@ -45,7 +45,9 @@ async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = fals
45
45
  const response = await fetch(`https://api.githubcopilot.com${endpoint}`, options);
46
46
  if (!response.ok) {
47
47
  const errorText = await response.text();
48
- const tokenInfo = token;
48
+ const tokenPrefix = token.substring(0, 4);
49
+ const tokenSuffix = token.substring(token.length - 5);
50
+ const tokenInfo = `${tokenPrefix}...${tokenSuffix}`;
49
51
  console.error(`❌ GitHub Copilot API Error: ${response.status} ${response.statusText}`);
50
52
  console.error(`❌ Error details: ${errorText}`);
51
53
  console.error(`❌ Used credential type: githubCopilotApi`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.17.0",
3
+ "version": "3.18.1",
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",