Skip to content

Commit 8892137

Browse files
committed
fix: log | new logos counts all logos
1 parent 2ba7dd7 commit 8892137

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/lib/scripts/create-pr.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,22 @@ function analyzeChanges() {
339339
stats.newTokens = addresses.length
340340
}
341341

342-
// Check for new logo files
343-
if (fs.existsSync(CONFIG.ASSETS_DIR)) {
344-
const files = fs.readdirSync(CONFIG.ASSETS_DIR)
345-
stats.newLogos = files.length
342+
// Check for new logo files by counting only the newly added files
343+
try {
344+
const result = execSync('git diff --cached --name-only --diff-filter=A', {
345+
encoding: 'utf8',
346+
})
347+
const newFiles = result
348+
.trim()
349+
.split('\n')
350+
.filter((file) => file.startsWith(CONFIG.ASSETS_DIR))
351+
stats.newLogos = newFiles.length
352+
} catch (error) {
353+
// Fallback: count all files in directory if git command fails
354+
if (fs.existsSync(CONFIG.ASSETS_DIR)) {
355+
const files = fs.readdirSync(CONFIG.ASSETS_DIR)
356+
stats.newLogos = files.length
357+
}
346358
}
347359

348360
log(`Analysis: ${stats.newTokens} tokens, ${stats.newLogos} logo files`)

0 commit comments

Comments
 (0)