n8n-nodes-github-copilot 3.6.2 → 3.7.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.
- package/dist/credentials/GitHubApi.credentials.d.ts +2 -1
- package/dist/credentials/GitHubApi.credentials.js +7 -0
- package/dist/credentials/GitHubApiManual.credentials.js +2 -2
- package/dist/nodes/GitHubCopilotChatAPI/utils/helpers.js +17 -1
- package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.js +17 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
1
|
+
import { ICredentialType, INodeProperties, ICredentialTestRequest } from 'n8n-workflow';
|
|
2
2
|
export declare class GitHubApi implements ICredentialType {
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
5
|
extends: string[];
|
|
6
6
|
documentationUrl: string;
|
|
7
7
|
properties: INodeProperties[];
|
|
8
|
+
test: ICredentialTestRequest;
|
|
8
9
|
}
|
|
@@ -15,7 +15,7 @@ class GitHubApiManual {
|
|
|
15
15
|
required: true,
|
|
16
16
|
default: '',
|
|
17
17
|
placeholder: 'gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
18
|
-
description: 'GitHub
|
|
18
|
+
description: 'GitHub Copilot access token. Must start with "gho_" for GitHub Copilot API. Personal Access Tokens (ghp_*) are not supported.',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
displayName: 'Token Type Info',
|
|
@@ -25,7 +25,7 @@ class GitHubApiManual {
|
|
|
25
25
|
displayOptions: {
|
|
26
26
|
show: {},
|
|
27
27
|
},
|
|
28
|
-
description: '
|
|
28
|
+
description: '⚠️ IMPORTANT: Only GitHub Copilot tokens (gho_*) work with this API. Personal Access Tokens (ghp_*) and other formats will be rejected with authentication errors. Contact your organization admin to obtain a proper GitHub Copilot access token.',
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
31
|
}
|
|
@@ -11,8 +11,24 @@ exports.validateTokenLimit = validateTokenLimit;
|
|
|
11
11
|
exports.truncateToTokenLimit = truncateToTokenLimit;
|
|
12
12
|
async function makeApiRequest(context, endpoint, body, hasMedia = false) {
|
|
13
13
|
const credentials = await context.getCredentials('githubApi');
|
|
14
|
+
const token = credentials.accessToken;
|
|
15
|
+
if (!token) {
|
|
16
|
+
throw new Error('GitHub Copilot: No access token found in credentials');
|
|
17
|
+
}
|
|
18
|
+
if (!token.startsWith('gho_')) {
|
|
19
|
+
const tokenPrefix = token.substring(0, token.indexOf('_') + 1) || token.substring(0, 4);
|
|
20
|
+
const tokenSuffix = token.length > 5 ? token.substring(token.length - 5) : token;
|
|
21
|
+
console.error(`❌ GitHub Copilot Auth Debug: Invalid token format. Got: ${tokenPrefix}...${tokenSuffix}`);
|
|
22
|
+
throw new Error(`GitHub Copilot API requires GitHub Copilot tokens (gho_*). ` +
|
|
23
|
+
`Received token with prefix: ${tokenPrefix}...${tokenSuffix}. ` +
|
|
24
|
+
`Personal Access Tokens (ghp_*) and other formats are not supported. ` +
|
|
25
|
+
`Please obtain a GitHub Copilot access token from your organization.`);
|
|
26
|
+
}
|
|
27
|
+
const tokenPrefix = token.substring(0, token.indexOf('_') + 1);
|
|
28
|
+
const tokenSuffix = token.substring(token.length - 5);
|
|
29
|
+
console.log(`🔍 GitHub Copilot Auth Debug: Using token ${tokenPrefix}...${tokenSuffix}`);
|
|
14
30
|
const headers = {
|
|
15
|
-
'Authorization': `Bearer ${
|
|
31
|
+
'Authorization': `Bearer ${token}`,
|
|
16
32
|
'Content-Type': 'application/json',
|
|
17
33
|
'User-Agent': 'n8n-github-copilot-chat-api-node',
|
|
18
34
|
};
|
|
@@ -108,6 +108,22 @@ class GitHubCopilotChatModel {
|
|
|
108
108
|
const options = this.getNodeParameter('options', itemIndex, {});
|
|
109
109
|
const modelInfo = GitHubCopilotModels_1.GitHubCopilotModelsManager.getModelByValue(model);
|
|
110
110
|
const credentials = await this.getCredentials('gitHubApiManual');
|
|
111
|
+
const token = credentials.accessToken;
|
|
112
|
+
if (!token) {
|
|
113
|
+
throw new Error('GitHub Copilot: No access token found in credentials');
|
|
114
|
+
}
|
|
115
|
+
if (!token.startsWith('gho_')) {
|
|
116
|
+
const tokenPrefix = token.substring(0, token.indexOf('_') + 1) || token.substring(0, 4);
|
|
117
|
+
const tokenSuffix = token.length > 5 ? token.substring(token.length - 5) : token;
|
|
118
|
+
console.error(`❌ GitHub Copilot Auth Debug: Invalid token format. Got: ${tokenPrefix}...${tokenSuffix}`);
|
|
119
|
+
throw new Error(`GitHub Copilot API requires GitHub Copilot tokens (gho_*). ` +
|
|
120
|
+
`Received token with prefix: ${tokenPrefix}...${tokenSuffix}. ` +
|
|
121
|
+
`Personal Access Tokens (ghp_*) and other formats are not supported. ` +
|
|
122
|
+
`Please obtain a GitHub Copilot access token from your organization.`);
|
|
123
|
+
}
|
|
124
|
+
const tokenPrefix = token.substring(0, token.indexOf('_') + 1);
|
|
125
|
+
const tokenSuffix = token.substring(token.length - 5);
|
|
126
|
+
console.log(`🔍 GitHub Copilot Auth Debug: Using token ${tokenPrefix}...${tokenSuffix}`);
|
|
111
127
|
const safeModel = modelInfo ? model : GitHubCopilotModels_1.DEFAULT_MODELS.GENERAL;
|
|
112
128
|
const safeModelInfo = modelInfo || GitHubCopilotModels_1.GitHubCopilotModelsManager.getModelByValue(GitHubCopilotModels_1.DEFAULT_MODELS.GENERAL);
|
|
113
129
|
const modelConfig = {
|
|
@@ -117,7 +133,7 @@ class GitHubCopilotChatModel {
|
|
|
117
133
|
topP: options.topP || 1,
|
|
118
134
|
configuration: {
|
|
119
135
|
baseURL: 'https://api.githubcopilot.com',
|
|
120
|
-
apiKey:
|
|
136
|
+
apiKey: token,
|
|
121
137
|
defaultHeaders: {
|
|
122
138
|
'User-Agent': 'n8n-github-copilot-chat-model',
|
|
123
139
|
'Accept': 'application/json',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
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",
|