Skip to content

[codex] Compact gh-pages history - #2239

Merged
cixzhang merged 1 commit into
mainfrom
codex/compact-gh-pages-history
Jun 4, 2026
Merged

cixzhang merged 1 commit into
mainfrom
codex/compact-gh-pages-history

Conversation

@thedjpetersen

@thedjpetersen thedjpetersen commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #2238.

Adds a gh-pages history compaction path so generated Pages artifacts do not keep accumulating in normal clones:

  • adds .github/scripts/compact-gh-pages-history.sh, which rewrites the current gh-pages tree as a single commit with --force-with-lease
  • adds a manual/scheduled Compact GitHub Pages History workflow
  • makes the main Pages deploy use force_orphan: true so main deploys also collapse old generated artifact history

Why

The current clone bloat was caused by generated Storybook/Sandbox preview and report artifacts retained in gh-pages history. Cleanup commits remove old files from the live Pages tree, but they do not remove blobs from Git history.

One-time cleanup

Already ran the one-time branch compaction from this branch locally:

  • old gh-pages: 2c84ef7a58a8439c4d0c709e68dad60966d900e6
  • new gh-pages: 531f620791ca6d5235644710fb555cd316238519

This PR keeps that cleanup from regressing after merge.

Validation

  • bash -n .github/scripts/compact-gh-pages-history.sh
  • ./scripts/add-copyright.sh --check
  • YAML parsed with Ruby for .github/workflows/compact-gh-pages.yml and .github/workflows/deploy.yml
  • git diff --check

@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

@thedjpetersen must be a member of the Meta Open Source team on Vercel to deploy.
- Click here to add @thedjpetersen to the team.
- If you initiated this build, request access.

Learn more about collaboration on Vercel and other options here.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label May 20, 2026
@thedjpetersen
thedjpetersen force-pushed the codex/compact-gh-pages-history branch from 7631635 to d245851 Compare May 20, 2026 03:35
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 19.3KB 29.8KB 4.5KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@thedjpetersen
thedjpetersen marked this pull request as ready for review May 20, 2026 18:36

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cixzhang
cixzhang merged commit f0f3e48 into main Jun 4, 2026
20 of 21 checks passed
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
@cixzhang
cixzhang deleted the codex/compact-gh-pages-history branch June 21, 2026 16:54
cixzhang added a commit that referenced this pull request Aug 5, 2026
…an commit (#4718)

Every push to main has had its Deploy job cancelled for ~a day (15-min job
timeout). The deploy job cloned all of gh-pages and `cp -r`'d the entire
/pr/ tree forward on every push. With ~52 live previews (>1GB, ~40k files)
the clone + two copies blew the 15-min budget before the publish step ever ran.

The cost was O(all live previews) per deploy — a full local copy of the tree
was required because peaceiris `force_orphan:true` publishes whatever is in
publish_dir.

Fix: build the single orphan commit ourselves and reuse /pr/ & /reports/ by
SHA instead of copying them:
  - --filter=blob:none + sparse-checkout materializes ONLY the stable paths
    (storybook/ sandbox/ assets/ + root files). /pr/ & /reports/ (the >1GB of
    preview blobs) are never fetched or written — they stay in the index as
    skip-worktree entries.
  - clean-replace the stable paths so superseded content-hashed assets don't
    accumulate (keeps what keep_files:false originally fixed, #916).
  - git write-tree rebuilds the full tree from the index (pr/ & reports/ reused
    by SHA); git commit-tree with no parent produces a single orphan commit —
    the same clean-slate history force_orphan gave us (#2239/#2238), now without
    a full local copy of gh-pages.
  - push with --force-with-lease + retry to stay safe against concurrent
    gh-pages writers (other main deploys, PR-preview pushes).

Deploy time is now O(1) in preview count. compact-gh-pages.yml stays as the
weekly history backstop.

Note: deploy-preview.yml still full-clones gh-pages per preview push (same
root pattern, not yet at the timeout) — worth the same treatment as a follow-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim gh-pages artifact history from default clones

2 participants