Skip to content

Commit fa721d4

Browse files
committed
feat: annotate game label adds with detection source in backfill logs
Each game label add now shows its source in the per-issue log line: #240: added "game: Opposing Force" (text-match) #248: added "game: Counter-Strike: Global Offensive" (form-field) #N: added "game: X" (ai-fallback) Non-game labels (engine, type, needs, etc.) are unchanged.
1 parent c7abb44 commit fa721d4

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/labeler.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ jobs:
12931293
12941294
// Games and engines
12951295
const desiredGames = new Set();
1296+
const gameLabelSource = new Map(); // label → 'form-field' | 'text-match' | 'ai-fallback'
12961297
const desiredServerScripts = new Set();
12971298
const gameField = extractSection(body, 'Game');
12981299
const gameCandidates = parseGameCandidates(gameField);
@@ -1301,15 +1302,21 @@ jobs:
13011302
const normalizedCandidate = normalizeName(candidate);
13021303
const mapped =
13031304
gameAliasToLabel.get(normalizedCandidate) || gameLabelByNormalized.get(normalizedCandidate);
1304-
if (mapped) desiredGames.add(mapped);
1305+
if (mapped) {
1306+
desiredGames.add(mapped);
1307+
gameLabelSource.set(mapped, 'form-field');
1308+
}
13051309
const mappedScript = gameAliasToScript.get(normalizedCandidate);
13061310
if (mappedScript) desiredServerScripts.add(mappedScript);
13071311
}
13081312
13091313
// Legacy issues often have no form section; fall back to deterministic text matching.
13101314
if (desiredGames.size === 0) {
13111315
const fromText = findGamesFromText(`${title}\n${body}`, gameAliasToLabel, gameAliasToScript);
1312-
for (const label of fromText.labels) desiredGames.add(label);
1316+
for (const label of fromText.labels) {
1317+
desiredGames.add(label);
1318+
gameLabelSource.set(label, 'text-match');
1319+
}
13131320
for (const scriptName of fromText.scripts) desiredServerScripts.add(scriptName);
13141321
}
13151322
@@ -1365,6 +1372,7 @@ jobs:
13651372
);
13661373
if (hasAliasEvidence) {
13671374
desiredGames.add(mappedLabel);
1375+
gameLabelSource.set(mappedLabel, 'ai-fallback');
13681376
const mappedScript = gameAliasToScript.get(detectedGame);
13691377
if (mappedScript) desiredServerScripts.add(mappedScript);
13701378
aiGameMatches += 1;
@@ -1451,7 +1459,8 @@ jobs:
14511459
labels: [label],
14521460
});
14531461
labelAdded += 1;
1454-
console.log(`#${rawIssue.number}: added "${label}"`);
1462+
const gameSource = gameLabelSource.get(label);
1463+
console.log(`#${rawIssue.number}: added "${label}"${gameSource ? ` (${gameSource})` : ''}`);
14551464
} catch (err) {
14561465
console.log(`#${rawIssue.number}: could not add "${label}": ${err.message}`);
14571466
}

0 commit comments

Comments
 (0)