Skip to content

Commit 1a8daea

Browse files
committed
Add version log on start app
1 parent e787d95 commit 1a8daea

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ async function run() {
88
const mode = core.getInput('mode') || 'full';
99
const dbType = core.getInput('db_type') || 'chromadb';
1010

11+
let version = "unknown";
12+
try {
13+
const fs = require('fs');
14+
const path = require('path');
15+
const packageJsonPath = path.resolve(__dirname, './package.json');
16+
if (fs.existsSync(packageJsonPath)) {
17+
const packageData = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
18+
version = packageData.version || "unknown";
19+
}
20+
} catch (versionError) {
21+
console.error('Error getting version:', versionError.message);
22+
}
23+
24+
console.log(`Vector code map generator v${version}`);
25+
1126
// Отримання шляху до репозиторію
1227
const repoPath = process.env.GITHUB_WORKSPACE || '.';
1328

localRun.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
require('dotenv').config();
22
const { getDbAdapter } = require('./src/db');
33
const { scanRepository } = require('./src/scanners');
4+
const path = require("path");
5+
const fs = require("fs");
46

57
async function localRun() {
68
try {
79
// Отримуємо налаштування з .env
810
const mode = process.env.MODE || 'full';
911
const dbType = process.env.DB_TYPE || 'chromadb';
1012

13+
let version = "unknown";
14+
try {
15+
const fs = require('fs');
16+
const path = require('path');
17+
const packageJsonPath = path.resolve(__dirname, './package.json');
18+
if (fs.existsSync(packageJsonPath)) {
19+
const packageData = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
20+
version = packageData.version || "unknown";
21+
}
22+
} catch (versionError) {
23+
console.error('Error getting version:', versionError.message);
24+
}
25+
26+
console.log(`Vector code map generator v${version}`);
27+
1128
// OpenAI налаштування
1229
const openaiApiKey = process.env.OPENAI_API_KEY;
1330
if (!openaiApiKey) throw new Error('OPENAI_API_KEY not set');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"openai",
1616
"chromadb"
1717
],
18-
"author": "Your Organization",
18+
"author": "Octanium91",
1919
"license": "MIT",
2020
"dependencies": {
2121
"@actions/core": "^1.10.0",

0 commit comments

Comments
 (0)