Compare commits

...

2 Commits

Author SHA1 Message Date
Romeo Van Snick
d0815d3471 Stamp bundle-size rows with the commit's timestamp, not the day they ran
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01171Lkmug15JzrcN2aMBLMk
2026-09-11 00:09:19 -07:00
Romeo Van Snick
6b27c064dc Stamp load-time rows with the commit's timestamp, not the day they ran
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01171Lkmug15JzrcN2aMBLMk
2026-09-11 00:02:49 -07:00
4 changed files with 12 additions and 3 deletions

View File

@@ -200,7 +200,9 @@ export function main() {
// The last plotted point, as slim rows: [{ bundle, kind, rawBytes, gzipBytes, brotliBytes }].
previous: readJson<CacheRow[]>(env.LAST) || [],
threshold: Number(env.MIN_DELTA_PERCENT ?? 1),
date: new Date().toISOString().slice(0, 10), // YYYY-MM-DD
// The commit's own time rather than the day it was measured, so the merges
// of one day keep their order on the chart.
date: new Date(env.COMMIT_TIMESTAMP || Date.now()).toISOString(),
commit: (env.HEAD_SHA || "").slice(0, 12),
commitMessage: (env.COMMIT_MESSAGE || "").split("\n")[0], // subject line only
version: readVersion(env.VERSION_PROPS),

View File

@@ -31,16 +31,20 @@ interface Condition {
interface CommitStamp {
sha: string;
subject: string;
/** ISO 8601, in UTC. */
timestamp: string;
}
type LoadTimeRow = Record<string, string | number>;
function buildRows(
conditions: Condition[],
{ sha, subject }: CommitStamp,
{ sha, subject, timestamp }: CommitStamp,
): LoadTimeRow[] {
return conditions.map((condition) => ({
Date: new Date().toISOString().slice(0, 10),
// The commit's own time rather than the day it was measured, so the merges
// of one day keep their order and a backfilled row lands on its commit.
Date: timestamp,
// Truncated the same way the bundle-size table does, so the two join.
Commit: sha.slice(0, 12),
// The stats table carries a free-text Description column. Populate it with
@@ -77,6 +81,7 @@ async function main() {
const rows = buildRows(conditions, {
sha: process.env.HEAD_SHA || "",
subject: process.env.COMMIT_MESSAGE || "",
timestamp: new Date(process.env.COMMIT_TIMESTAMP || Date.now()).toISOString(),
});
console.table(rows);

View File

@@ -134,6 +134,7 @@ jobs:
# Passed via env (not interpolated into the shell) so the commit
# message can't inject commands; the script keeps only the subject.
COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
COMMIT_TIMESTAMP: ${{ github.event.workflow_run.head_commit.timestamp }}
run: bun ./.github/scripts/bundle-size-stats-prepare.ts
- name: Import sizes (with deltas) into Stats
id: upload

View File

@@ -120,6 +120,7 @@ jobs:
# Passed via env (not interpolated into the shell) so the commit
# message can't inject commands; the script keeps only the subject.
COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
COMMIT_TIMESTAMP: ${{ github.event.workflow_run.head_commit.timestamp }}
ENG_STATS_URL: ${{ secrets.ENG_STATS_URL }}
API_KEY: ${{ secrets.ENG_STATS_API_KEY }}
run: bun .github/scripts/upload-bundle-load-stats.ts