Skip to content

Conversation

@blackgirlbytes
Copy link
Contributor

Problem

The gh-pages branch grew to 9.6 GB causing GitHub Pages deployments to fail with:

System.IO.IOException: No space left on device

Root Cause

The deploy workflow had keep_files: true which preserved all existing files across deployments:

- name: Deploy to /gh-pages
  uses: peaceiris/actions-gh-pages@v3
  with:
    keep_files: true  # <-- THE PROBLEM

This caused bloat because:

  1. Docusaurus hashes asset filenames (e.g., image-abc123.png)
  2. When an image is updated/renamed, a new hashed file is created
  3. The old file is never deleted due to keep_files: true
  4. Over months of deployments, thousands of orphaned files accumulate

Example:

Deploy #1: image-aaa.png (500KB)
Deploy #2: image-bbb.png (500KB) + image-aaa.png still there
Deploy #3: image-ccc.png (500KB) + image-bbb.png + image-aaa.png
... repeat 100x ...

Solution

  1. Set keep_files: false - Do clean deployments instead of accumulating files
  2. Set force_orphan: true - Prevent git history bloat by creating fresh commits
  3. Preserve pr-preview/ directory - Copy it from the current gh-pages before deploying so active PR previews aren't deleted

Each deployment now produces a clean gh-pages branch with only:

  • The current documentation build (~500 MB)
  • Active PR preview directories

Testing

  • Manually cleaned gh-pages branch (9.6 GB → 515 MB)
  • Verified site deploys correctly after cleanup
  • Verify PR previews are preserved after this change merges

Related

This PR was created after manually cleaning the gh-pages branch to fix the immediate deployment failure.

The gh-pages branch grew to 9.6GB due to `keep_files: true` which
preserved all old assets across deployments. Docusaurus hashes asset
filenames, so renamed/updated images created new files while old ones
remained forever.

Changes:
- Set `keep_files: false` to do clean deployments
- Set `force_orphan: true` to prevent git history bloat
- Add step to preserve pr-preview/ directory before deploying
  (so active PR previews aren't deleted)

This ensures each deployment is a clean slate with only:
1. The current documentation build
2. Active PR preview directories
Copilot AI review requested due to automatic review settings January 5, 2026 20:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes GitHub Pages deployment failures caused by the gh-pages branch growing to 9.6 GB. The solution changes from incremental deployments to clean deployments while preserving active PR previews.

Key changes:

  • Switches from keep_files: true to keep_files: false to prevent accumulation of orphaned hashed assets
  • Adds force_orphan: true to prevent git history bloat
  • Manually preserves the pr-preview/ directory by copying it from the current gh-pages branch before deployment

Both workflows now use 'concurrency: pr-preview' to serialize operations
on the gh-pages branch, preventing a race condition where a PR preview
created between checkout and deploy would be lost.
Handles edge case where gh-pages branch doesn't exist (first deploy or forks).
Copilot AI review requested due to automatic review settings January 5, 2026 20:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Collaborator

@jamadeo jamadeo left a comment

Choose a reason for hiding this comment

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

Nice! Looks like a clean solution to reducing the bloat of old pr preview deployments.

@blackgirlbytes blackgirlbytes merged commit 4050502 into main Jan 5, 2026
26 checks passed
@blackgirlbytes blackgirlbytes deleted the fix/gh-pages-bloat-prevention branch January 5, 2026 21:34
zanesq added a commit that referenced this pull request Jan 6, 2026
* 'main' of github.com:block/goose:
  refactor:  when changing provider/model,load existing provider/model (#6334)
  chore: refactor configure_extensions_dialog to reduce line count (#6277)
  chore: refactor handle_configure to reduce line count (#6276)
  chore: refactor interactive session to reduce line count (#6274)
  chore: refactor docx_tool to reduce function size (#6273)
  chore: refactor cli() function to reduce line count (#6272)
  make sure the models are using streaming properly (#6331)
  feat: add a max tokens env var (#6264)
  docs: slash commands topic (#6333)
  fix(ci): prevent gh-pages branch bloat (#6340)
  chore(deps): bump qs and body-parser in /documentation (#6338)
  Skip the smoke tests for dependabot PRs (#6337)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants