• Will Chen's avatar
    ci: add nightly disk cleanup for self-hosted runner ci1 (#2620) · ea61dc53
    Will Chen 提交于
    Adds a scheduled GitHub Actions workflow that safely frees disk space on
    self-hosted macOS runner `ci1` at 4:00 AM PST to prevent CI from running
    out of space.
    
    ## Changes
    - **New workflow** `.github/workflows/nightly-runner-cleanup.yml`: Runs
    daily at 4 AM PST; only executes on runner `ci1`
    - **Extended cleanup script** `scripts/ci-cleanup-macos.sh`:
    `CI_NIGHTLY_CLEANUP=1` enables host-level cleanup:
      - `~/Library/Caches` subdirs (Homebrew, Xcode, LLVM)
      - npm cache
      - Runner `_work` dirs older than 2 days
    - **Documentation** in workflows README with validation steps
    
    ## Safety
    - Only allowlisted paths are deleted
    - Never removes runner binaries, config, or user data
    - Manual run via `workflow_dispatch` for testing
    
    Made with [Cursor](https://cursor.com)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2620"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Medium Risk**
    > Primarily CI automation changes, but it introduces scheduled `rm -rf`
    cleanup on a self-hosted runner; an allowlist/guard is present, yet
    mistakes could still delete useful caches or workspaces and disrupt
    builds.
    > 
    > **Overview**
    > Adds a scheduled `Nightly Runner Cleanup` GitHub Actions workflow that
    runs daily (and via `workflow_dispatch`) on self-hosted macOS runners,
    guarded to execute only when `RUNNER_NAME` is `ci1`.
    > 
    > Extends `scripts/ci-cleanup-macos.sh` with a `CI_NIGHTLY_CLEANUP=1`
    mode that additionally purges allowlisted `~/Library/Caches`
    subdirectories and removes stale runner `actions-runner/_work`
    directories older than 2 days, and updates the workflows README with the
    new workflow and manual validation steps.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    0b108a8a7969060614311f54cd694f0454a6839b. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Adds a nightly GitHub Actions workflow to free disk on self-hosted macOS
    runner ci1 at 4:00 AM PST. Extends the cleanup script with a guarded
    nightly mode to remove allowlisted caches and stale work dirs so CI
    doesn’t run out of space.
    
    - **New Features**
    - Added nightly-runner-cleanup.yml: runs daily at 4 AM PST; only
    executes on runner ci1; supports manual workflow_dispatch.
    - Updated scripts/ci-cleanup-macos.sh: CI_NIGHTLY_CLEANUP=1 cleans
    Library/Caches subdirs (Homebrew, Xcode, org.llvm.clang*), npm cache,
    Playwright browsers, and runner _work dirs older than 2 days; prints
    mode and disk before/after.
      - Updated README with manual validation steps.
    
    <sup>Written for commit 0b108a8a7969060614311f54cd694f0454a6839b.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarCursor <cursoragent@cursor.com>
    Co-authored-by: 's avatardevin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
    ea61dc53
ci-cleanup-macos.sh 6.7 KB