Skip to content

Commit 840e890

Browse files
committed
fix: avoid pruning legacy game labels without structured game input
Only remove existing game:* labels when an issue has explicit structured Game form selections. For legacy title/body inference (and AI fallback), add matched game labels but do not remove other existing game labels. This prevents edge cases like issue #1 from losing valid multi-game tags.
1 parent 54007fd commit 840e890

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/labeler.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ jobs:
436436
const desiredGames = new Set();
437437
const desiredServerScripts = new Set();
438438
const gameField = extractSection('Game');
439-
for (const candidate of parseGameCandidates(gameField)) {
439+
const gameCandidates = parseGameCandidates(gameField);
440+
const hasStructuredGameSelection = gameCandidates.length > 0;
441+
for (const candidate of gameCandidates) {
440442
const normalizedCandidate = normalizeName(candidate);
441443
const mapped = gameAliasToLabel.get(normalizedCandidate) || gameLabelByNormalized.get(normalizedCandidate);
442444
if (mapped) desiredGames.add(mapped);
@@ -576,9 +578,11 @@ jobs:
576578
577579
if (desiredGames.size > 0) {
578580
for (const label of desiredGames) labelsToAdd.add(label);
579-
for (const label of existingLabels) {
580-
if (label.startsWith('game: ') && !desiredGames.has(label)) {
581-
labelsToRemove.add(label);
581+
if (hasStructuredGameSelection) {
582+
for (const label of existingLabels) {
583+
if (label.startsWith('game: ') && !desiredGames.has(label)) {
584+
labelsToRemove.add(label);
585+
}
582586
}
583587
}
584588
}
@@ -1277,7 +1281,9 @@ jobs:
12771281
const desiredGames = new Set();
12781282
const desiredServerScripts = new Set();
12791283
const gameField = extractSection(body, 'Game');
1280-
for (const candidate of parseGameCandidates(gameField)) {
1284+
const gameCandidates = parseGameCandidates(gameField);
1285+
const hasStructuredGameSelection = gameCandidates.length > 0;
1286+
for (const candidate of gameCandidates) {
12811287
const normalizedCandidate = normalizeName(candidate);
12821288
const mapped =
12831289
gameAliasToLabel.get(normalizedCandidate) || gameLabelByNormalized.get(normalizedCandidate);
@@ -1375,8 +1381,10 @@ jobs:
13751381
13761382
if (desiredGames.size > 0) {
13771383
for (const label of desiredGames) labelsToAdd.add(label);
1378-
for (const label of existingLabels) {
1379-
if (label.startsWith('game: ') && !desiredGames.has(label)) labelsToRemove.add(label);
1384+
if (hasStructuredGameSelection) {
1385+
for (const label of existingLabels) {
1386+
if (label.startsWith('game: ') && !desiredGames.has(label)) labelsToRemove.add(label);
1387+
}
13801388
}
13811389
}
13821390

0 commit comments

Comments
 (0)