Skip to content

Commit 595b1db

Browse files
committed
fix error "warning: Not a git repository. Use --no-index to compare two paths outside a working tree"
1 parent 3266321 commit 595b1db

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ async function run() {
77
// Отримуємо налаштування з GitHub Actions
88
const mode = core.getInput('mode') || 'full';
99
const dbType = core.getInput('db_type') || 'chromadb';
10+
11+
// Отримання шляху до репозиторію
12+
const repoPath = process.env.GITHUB_WORKSPACE || '.';
1013

1114
// OpenAI налаштування
1215
const openaiApiKey = core.getInput('openai_api_key', { required: true });
@@ -23,8 +26,8 @@ async function run() {
2326

2427
const { execSync } = require('child_process');
2528
try {
26-
execSync('git config --global --add safe.directory /github/workspace');
27-
console.log('Added /github/workspace as safe directory');
29+
execSync('git config --global --add safe.directory '+repoPath);
30+
console.log('Added '+repoPath+' as safe directory');
2831
} catch (error) {
2932
console.error('Failed to configure safe directory:', error.message);
3033
}
@@ -61,8 +64,6 @@ async function run() {
6164
process.env.MAX_TOKENS_PER_BATCH = MAX_TOKENS_PER_BATCH;
6265

6366
// Запускаємо сканування репозиторію
64-
const repoPath = process.env.GITHUB_WORKSPACE || '.';
65-
6667
await scanRepository({
6768
repoPath,
6869
dbAdapter,

0 commit comments

Comments
 (0)