mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-09 19:03:28 +08:00
fix: refresh existing monthly metrics snapshots
This commit is contained in:
21
.github/workflows/monthly-metrics.yml
vendored
21
.github/workflows/monthly-metrics.yml
vendored
@@ -30,6 +30,10 @@ jobs:
|
|||||||
return match ? Number(match[1]) : null;
|
return match ? Number(match[1]) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeRegex(value) {
|
||||||
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
}
|
||||||
|
|
||||||
function fmt(value) {
|
function fmt(value) {
|
||||||
if (value === null || value === undefined) return "n/a";
|
if (value === null || value === undefined) return "n/a";
|
||||||
return Number(value).toLocaleString("en-US");
|
return Number(value).toLocaleString("en-US");
|
||||||
@@ -167,14 +171,17 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const currentBody = issue.body || "";
|
const currentBody = issue.body || "";
|
||||||
if (currentBody.includes(`| ${monthKey} |`)) {
|
const rowPattern = new RegExp(`^\\| ${escapeRegex(monthKey)} \\|.*$`, "m");
|
||||||
console.log(`Issue #${issue.number} already has snapshot row for ${monthKey}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const body = currentBody.includes("| Month (UTC) |")
|
let body;
|
||||||
? `${currentBody.trimEnd()}\n${row}\n`
|
if (rowPattern.test(currentBody)) {
|
||||||
: `${intro}\n${row}\n`;
|
body = currentBody.replace(rowPattern, row);
|
||||||
|
console.log(`Refreshed issue #${issue.number} snapshot row for ${monthKey}`);
|
||||||
|
} else {
|
||||||
|
body = currentBody.includes("| Month (UTC) |")
|
||||||
|
? `${currentBody.trimEnd()}\n${row}\n`
|
||||||
|
: `${intro}\n${row}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
await github.rest.issues.update({
|
await github.rest.issues.update({
|
||||||
owner,
|
owner,
|
||||||
|
|||||||
Reference in New Issue
Block a user