Merge pull request #1217 from j2h4u/fix/task-count-pattern

fix(milestone): read task count from **Tasks:** field in summary body
This commit is contained in:
Tom Boucher
2026-03-19 12:04:37 -04:00
committed by GitHub
2 changed files with 34 additions and 3 deletions

View File

@@ -134,9 +134,16 @@ function cmdMilestoneComplete(cwd, version, options, raw) {
if (fm['one-liner']) {
accomplishments.push(fm['one-liner']);
}
// Count tasks
const taskMatches = content.match(/##\s*Task\s*\d+/gi) || [];
totalTasks += taskMatches.length;
// Count tasks: prefer **Tasks:** N from Performance section,
// then <task XML tags, then ## Task N markdown headers
const tasksFieldMatch = content.match(/\*\*Tasks:\*\*\s*(\d+)/);
if (tasksFieldMatch) {
totalTasks += parseInt(tasksFieldMatch[1], 10);
} else {
const xmlTaskMatches = content.match(/<task[\s>]/gi) || [];
const mdTaskMatches = content.match(/##\s*Task\s*\d+/gi) || [];
totalTasks += xmlTaskMatches.length || mdTaskMatches.length;
}
} catch { /* intentionally empty */ }
}
}