719032b19f
Update Schema / Update configuration json schema (push) Has been cancelled
Memory Benchmark / Memory Test (Full Analysis) (push) Has been cancelled
CI Quality / Lint GitHub Actions (actionlint) (push) Has been cancelled
CI Quality / Lint GitHub Actions (zizmor) (push) Has been cancelled
CI Quality / Check typos (push) Has been cancelled
CI / Test coverage (push) Has been cancelled
CI / Test (22.x, windows-latest) (push) Has been cancelled
CI / Test (24.x, macos-latest) (push) Has been cancelled
CI / Test (24.x, ubuntu-latest) (push) Has been cancelled
CI / Test (24.x, windows-latest) (push) Has been cancelled
CI / Test (26.x, macos-latest) (push) Has been cancelled
CI / Test (26.x, ubuntu-latest) (push) Has been cancelled
CI / Test (26.x, windows-latest) (push) Has been cancelled
CI / Test with Bun (latest, macos-latest) (push) Has been cancelled
CI / Test with Bun (latest, ubuntu-latest) (push) Has been cancelled
CI / Test with Bun (latest, windows-latest) (push) Has been cancelled
CI / Build and run (22.x, macos-latest) (push) Has been cancelled
CI / Build and run (22.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (22.x, windows-latest) (push) Has been cancelled
autofix.ci / autofix (push) Has been cancelled
CI Browser Extension / Lint Browser Extension (push) Has been cancelled
CI Browser Extension / Test Browser Extension (push) Has been cancelled
Memory Benchmark / Memory Test (push) Has been cancelled
CI Website / Lint Website Client (push) Has been cancelled
CI Website / Lint Website Server (push) Has been cancelled
CI Website / Test Website Server (push) Has been cancelled
CI Website / Bundle Website Server (push) Has been cancelled
CI / Lint Biome (push) Has been cancelled
CI / Lint oxlint (push) Has been cancelled
CI / Lint TypeScript (push) Has been cancelled
CI / Lint Secretlint (push) Has been cancelled
CI / Test (22.x, macos-latest) (push) Has been cancelled
CI / Test (22.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (24.x, macos-latest) (push) Has been cancelled
CI / Build and run (24.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (24.x, windows-latest) (push) Has been cancelled
CI / Build and run (26.x, macos-latest) (push) Has been cancelled
CI / Build and run (26.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (26.x, windows-latest) (push) Has been cancelled
CI / Build and run with Bun (latest, macos-latest) (push) Has been cancelled
CI / Build and run with Bun (latest, ubuntu-latest) (push) Has been cancelled
CI / Build and run with Bun (latest, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Docker / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker / build (linux/arm/v7, ubuntu-24.04-arm) (push) Has been cancelled
Docker / build (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker / merge (push) Has been cancelled
Pack repository with Repomix / pack-repo (push) Has been cancelled
Performance Benchmark History / Benchmark (macos-latest) (push) Has been cancelled
Performance Benchmark History / Benchmark (ubuntu-latest) (push) Has been cancelled
Performance Benchmark History / Benchmark (windows-latest) (push) Has been cancelled
Performance Benchmark History / Store Results (push) Has been cancelled
Test Repomix Action / Test Node.js 22 (push) Has been cancelled
Test Repomix Action / Test Node.js 24 (push) Has been cancelled
Test Repomix Action / Test Node.js 26 (push) Has been cancelled
48 lines
2.0 KiB
JavaScript
48 lines
2.0 KiB
JavaScript
import { readFileSync, writeFileSync } from 'node:fs';
|
|
import { esc, extractHistory, renderHistory } from './bench-utils.mjs';
|
|
|
|
const shortSha = process.env.COMMIT_SHA.slice(0, 7);
|
|
const commitMsg = process.env.COMMIT_MSG;
|
|
const runUrl = process.env.WORKFLOW_RUN_URL;
|
|
const oldBody = readFileSync(`${process.env.RUNNER_TEMP}/old-comment.txt`, 'utf8');
|
|
|
|
let history = extractHistory(oldBody);
|
|
|
|
// If previous comment had completed results, archive them into history
|
|
if (oldBody.includes('\u2705 Benchmark complete!')) {
|
|
// Extract only the main result table (before any <details> block)
|
|
const mainSection = oldBody.split('<details>')[0] || '';
|
|
const commitMatch = mainSection.match(
|
|
/Latest commit:<\/strong><\/td><td>(?:<code>)?([a-f0-9]+)(?:<\/code>)?\s*(.*?)<\/td>/,
|
|
);
|
|
const prevSha = commitMatch ? commitMatch[1] : '';
|
|
const prevMsg = commitMatch ? commitMatch[2] : '';
|
|
if (prevSha) {
|
|
const rowRe = /<tr><td><strong>(Ubuntu|macOS|Windows):<\/strong><\/td><td>(.*?)<\/td><\/tr>/g;
|
|
const entry = { sha: prevSha, msg: prevMsg };
|
|
for (let m = rowRe.exec(mainSection); m !== null; m = rowRe.exec(mainSection)) {
|
|
entry[m[1].toLowerCase()] = m[2];
|
|
}
|
|
if (prevSha !== shortSha && !history.some((h) => h.sha === prevSha)) {
|
|
history.unshift(entry);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Keep max 50 entries
|
|
history = history.slice(0, 50);
|
|
|
|
const jsonComment = `<!-- bench-history-json-start ${JSON.stringify(history)} bench-history-json-end -->`;
|
|
let body = `<!-- repomix-perf-benchmark -->\n${jsonComment}\n`;
|
|
body += '## \u26a1 Performance Benchmark\n\n';
|
|
body += `<table><tr><td><strong>Latest commit:</strong></td><td>${shortSha} ${esc(commitMsg)}</td></tr>\n`;
|
|
body += '<tr><td><strong>Status:</strong></td><td>\u26a1 Benchmark in progress...</td></tr></table>\n\n';
|
|
body += `[Workflow run](${runUrl})`;
|
|
|
|
const historyHtml = renderHistory(history);
|
|
if (historyHtml) {
|
|
body += `\n\n<details>\n<summary>History</summary>\n\n${historyHtml}\n\n</details>`;
|
|
}
|
|
|
|
writeFileSync(`${process.env.RUNNER_TEMP}/new-comment.md`, body);
|