n8n-nodes-github-copilot 1.0.8 → 1.0.9
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.
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitHubApiManual = void 0;
|
|
4
|
+
class GitHubApiManual {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'gitHubApiManual';
|
|
7
|
+
this.displayName = 'GitHub API (Manual Token)';
|
|
8
|
+
this.documentationUrl = 'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Access Token',
|
|
12
|
+
name: 'accessToken',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: { password: true },
|
|
15
|
+
required: true,
|
|
16
|
+
default: '',
|
|
17
|
+
placeholder: 'gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
18
|
+
description: 'GitHub Personal Access Token with Copilot permissions. Must start with "gho_" for OAuth or "ghp_" for classic.',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Token Type Info',
|
|
22
|
+
name: 'tokenInfo',
|
|
23
|
+
type: 'notice',
|
|
24
|
+
default: '',
|
|
25
|
+
displayOptions: {
|
|
26
|
+
show: {},
|
|
27
|
+
},
|
|
28
|
+
description: 'For GitHub Copilot CLI, OAuth tokens (gho_) are recommended. Create at: GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.GitHubApiManual = GitHubApiManual;
|
|
@@ -62,7 +62,13 @@ class GitHubCopilot {
|
|
|
62
62
|
credentials: [
|
|
63
63
|
{
|
|
64
64
|
name: 'gitHubApi',
|
|
65
|
-
|
|
65
|
+
displayName: 'GitHub API (OAuth2)',
|
|
66
|
+
required: false,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'gitHubApiManual',
|
|
70
|
+
displayName: 'GitHub API (Manual Token)',
|
|
71
|
+
required: false,
|
|
66
72
|
},
|
|
67
73
|
],
|
|
68
74
|
properties: [
|
|
@@ -180,7 +186,24 @@ class GitHubCopilot {
|
|
|
180
186
|
const operation = this.getNodeParameter('operation', i);
|
|
181
187
|
const prompt = this.getNodeParameter('prompt', i);
|
|
182
188
|
const context = this.getNodeParameter('context', i, '');
|
|
183
|
-
|
|
189
|
+
let credentials;
|
|
190
|
+
let accessToken;
|
|
191
|
+
try {
|
|
192
|
+
credentials = await this.getCredentials('gitHubApi');
|
|
193
|
+
accessToken = credentials.accessToken;
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
try {
|
|
197
|
+
credentials = await this.getCredentials('gitHubApiManual');
|
|
198
|
+
accessToken = credentials.accessToken;
|
|
199
|
+
}
|
|
200
|
+
catch (manualError) {
|
|
201
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No GitHub credentials found. Please configure either OAuth2 or Manual Token credentials.');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (!accessToken) {
|
|
205
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'GitHub access token not found in credentials.');
|
|
206
|
+
}
|
|
184
207
|
let command;
|
|
185
208
|
let fullPrompt = prompt;
|
|
186
209
|
if (context) {
|
|
@@ -221,7 +244,6 @@ class GitHubCopilot {
|
|
|
221
244
|
default:
|
|
222
245
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
223
246
|
}
|
|
224
|
-
const accessToken = credentials.accessToken;
|
|
225
247
|
const { stdout, stderr } = await execAsync(command, {
|
|
226
248
|
env: {
|
|
227
249
|
...process.env,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
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",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"n8n": {
|
|
28
28
|
"n8nNodesApiVersion": 1,
|
|
29
29
|
"credentials": [
|
|
30
|
-
"dist/credentials/GitHubApi.credentials.js"
|
|
30
|
+
"dist/credentials/GitHubApi.credentials.js",
|
|
31
|
+
"dist/credentials/GitHubApiManual.credentials.js"
|
|
31
32
|
],
|
|
32
33
|
"nodes": [
|
|
33
34
|
"dist/nodes/GitHubCopilot/GitHubCopilot.node.js"
|