n8n-nodes-github-copilot 3.8.0 → 3.10.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/README.md
CHANGED
|
@@ -154,12 +154,15 @@ gh auth token
|
|
|
154
154
|
|
|
155
155
|
Para usar o **GitHub Copilot Chat API** (com modelos GPT-5, Claude, etc.):
|
|
156
156
|
|
|
157
|
-
1. **
|
|
158
|
-
2. **Configure a credencial**:
|
|
159
|
-
- **
|
|
160
|
-
- **
|
|
161
|
-
- **
|
|
162
|
-
3. **
|
|
157
|
+
1. **Use autenticação OAuth2**: Selecione **"GitHub OAuth2 API"** (credencial padrão do n8n)
|
|
158
|
+
2. **Configure a credencial OAuth2**:
|
|
159
|
+
- **Client ID**: Seu GitHub OAuth App Client ID
|
|
160
|
+
- **Client Secret**: Seu GitHub OAuth App Client Secret
|
|
161
|
+
- **Scope**: `copilot read:org repo user`
|
|
162
|
+
3. **Crie uma GitHub OAuth App**:
|
|
163
|
+
- Vá para GitHub → Settings → Developer settings → OAuth Apps
|
|
164
|
+
- Clique em "New OAuth App" e configure callback URL do n8n
|
|
165
|
+
4. **Vantagens**: Autenticação segura, renovação automática de tokens, acesso organizacional
|
|
163
166
|
|
|
164
167
|
## 🎮 Como Usar
|
|
165
168
|
|
|
@@ -10,23 +10,24 @@ exports.estimateTokens = estimateTokens;
|
|
|
10
10
|
exports.validateTokenLimit = validateTokenLimit;
|
|
11
11
|
exports.truncateToTokenLimit = truncateToTokenLimit;
|
|
12
12
|
async function makeApiRequest(context, endpoint, body, hasMedia = false) {
|
|
13
|
-
|
|
14
|
-
const
|
|
13
|
+
var _a;
|
|
14
|
+
const credentials = await context.getCredentials('githubOAuth2Api');
|
|
15
|
+
console.log('🔍 OAuth2 Credentials Debug:', Object.keys(credentials));
|
|
16
|
+
const token = (credentials.accessToken ||
|
|
17
|
+
credentials.access_token ||
|
|
18
|
+
((_a = credentials.oauthTokenData) === null || _a === void 0 ? void 0 : _a.access_token) ||
|
|
19
|
+
credentials.token);
|
|
15
20
|
if (!token) {
|
|
16
|
-
|
|
21
|
+
console.error('❌ Available credential properties:', Object.keys(credentials));
|
|
22
|
+
console.error('❌ Full credential object:', JSON.stringify(credentials, null, 2));
|
|
23
|
+
throw new Error('GitHub Copilot: No access token found in OAuth2 credentials. Available properties: ' + Object.keys(credentials).join(', '));
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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.`);
|
|
25
|
+
const tokenPrefix = token.substring(0, Math.min(4, token.indexOf('_') + 1)) || token.substring(0, 4);
|
|
26
|
+
const tokenSuffix = token.substring(Math.max(0, token.length - 5));
|
|
27
|
+
console.log(`🔍 GitHub Copilot OAuth2 Debug: Using token ${tokenPrefix}...${tokenSuffix}`);
|
|
28
|
+
if (!token.startsWith('gho_') && !token.startsWith('ghu_') && !token.startsWith('github_pat_')) {
|
|
29
|
+
console.warn(`⚠️ Unexpected token format: ${tokenPrefix}...${tokenSuffix}. Trying API call anyway.`);
|
|
26
30
|
}
|
|
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}`);
|
|
30
31
|
const headers = {
|
|
31
32
|
'Authorization': `Bearer ${token}`,
|
|
32
33
|
'Content-Type': '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.10.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",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc && gulp build:icons",
|
|
18
18
|
"dev": "tsc --watch",
|
|
19
|
-
"format": "prettier nodes --write",
|
|
20
|
-
"lint": "eslint nodes package.json",
|
|
21
|
-
"lintfix": "eslint nodes package.json --fix",
|
|
19
|
+
"format": "prettier nodes credentials --write",
|
|
20
|
+
"lint": "eslint nodes credentials package.json",
|
|
21
|
+
"lintfix": "eslint nodes credentials package.json --fix",
|
|
22
22
|
"prepublishOnly": "npm run build && npm run lint -s"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
],
|
|
27
27
|
"n8n": {
|
|
28
28
|
"n8nNodesApiVersion": 1,
|
|
29
|
-
"credentials": [
|
|
29
|
+
"credentials": [
|
|
30
|
+
"dist/credentials/GitHubApi.credentials.js",
|
|
31
|
+
"dist/credentials/GitHubApiManual.credentials.js"
|
|
32
|
+
],
|
|
30
33
|
"nodes": [
|
|
31
34
|
"dist/nodes/GitHubCopilot/GitHubCopilot.node.js",
|
|
32
35
|
"dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.js",
|