n8n-nodes-github-copilot 1.0.5 → 1.0.7
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.
|
@@ -8,22 +8,22 @@ class GitHubApi {
|
|
|
8
8
|
this.documentationUrl = 'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token';
|
|
9
9
|
this.properties = [
|
|
10
10
|
{
|
|
11
|
-
displayName: 'GitHub Token',
|
|
12
|
-
name: '
|
|
11
|
+
displayName: 'GitHub OAuth Token',
|
|
12
|
+
name: 'oauthToken',
|
|
13
13
|
type: 'string',
|
|
14
14
|
typeOptions: {
|
|
15
15
|
password: true,
|
|
16
16
|
},
|
|
17
17
|
default: '',
|
|
18
18
|
required: true,
|
|
19
|
-
description: 'GitHub
|
|
19
|
+
description: 'GitHub OAuth Token (gho_...) for GitHub Copilot CLI. Generate via: gh auth login --web. Required for Copilot CLI access.',
|
|
20
20
|
},
|
|
21
21
|
];
|
|
22
22
|
this.authenticate = {
|
|
23
23
|
type: 'generic',
|
|
24
24
|
properties: {
|
|
25
25
|
headers: {
|
|
26
|
-
Authorization: '=Bearer {{$credentials.
|
|
26
|
+
Authorization: '=Bearer {{$credentials.oauthToken}}',
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
};
|
|
@@ -178,9 +178,8 @@ class GitHubCopilot {
|
|
|
178
178
|
const { stdout, stderr } = await execAsync(command, {
|
|
179
179
|
env: {
|
|
180
180
|
...process.env,
|
|
181
|
-
|
|
181
|
+
GH_TOKEN: credentials.oauthToken,
|
|
182
182
|
HOME: '/opt/n8n-source/packages/cli/bin',
|
|
183
|
-
GH_TOKEN: credentials.accessToken,
|
|
184
183
|
},
|
|
185
184
|
timeout: 30000,
|
|
186
185
|
maxBuffer: 1024 * 1024,
|
|
@@ -188,18 +187,6 @@ class GitHubCopilot {
|
|
|
188
187
|
if (stderr && !stdout) {
|
|
189
188
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `GitHub Copilot CLI error: ${stderr}`);
|
|
190
189
|
}
|
|
191
|
-
const result = stdout.trim();
|
|
192
|
-
let suggestion = result;
|
|
193
|
-
if (operation === 'suggest' || operation === 'shell') {
|
|
194
|
-
const lines = result.split('\n');
|
|
195
|
-
const suggestionStart = lines.findIndex((line) => line.includes('Suggestion:') ||
|
|
196
|
-
line.includes('```') ||
|
|
197
|
-
line.trim().startsWith('$') ||
|
|
198
|
-
line.trim().startsWith('>'));
|
|
199
|
-
if (suggestionStart !== -1) {
|
|
200
|
-
suggestion = lines.slice(suggestionStart).join('\n').trim();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
190
|
returnData.push({
|
|
204
191
|
json: {
|
|
205
192
|
operation,
|
|
@@ -207,8 +194,7 @@ class GitHubCopilot {
|
|
|
207
194
|
context: context || undefined,
|
|
208
195
|
language: operation === 'suggest' ? this.getNodeParameter('language', i) : undefined,
|
|
209
196
|
commandType: operation === 'shell' ? this.getNodeParameter('commandType', i) : undefined,
|
|
210
|
-
|
|
211
|
-
rawOutput: result,
|
|
197
|
+
cliRawOutput: stdout,
|
|
212
198
|
timestamp: new Date().toISOString(),
|
|
213
199
|
},
|
|
214
200
|
pairedItem: { item: i },
|
package/package.json
CHANGED