-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix(ci): scope the Next.js build cache sticky disk per branch #6072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: CI Cache Cleanup | ||
|
|
||
| # test-build.yml keys the Next.js build cache sticky disk per branch, so every PR | ||
| # leaves a ~5 GB volume behind. Branches are short-lived; the disks aren't. Only | ||
| # the pull_request disks are reclaimed — the push disks belong to main/staging/dev | ||
| # and must stay warm. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| delete-nextjs-cache: | ||
| name: Delete Next.js build cache disk | ||
| # Sticky disks only exist on Blacksmith; the GitHub break-glass path uses | ||
| # actions/cache, which expires on its own. | ||
| if: vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith' | ||
| runs-on: blacksmith-2vcpu-ubuntu-2404 | ||
| timeout-minutes: 5 | ||
|
|
||
| steps: | ||
| # Must stay byte-identical to the Mount Next.js build cache key in | ||
| # test-build.yml, or this deletes nothing and the disks accumulate. | ||
| # Non-blocking: PRs skipped by ci.yml's paths-ignore never made a disk. | ||
| - name: Delete sticky disk | ||
| uses: useblacksmith/stickydisk-delete@b41313d28b8647d72114c9ba3c96bb04061562b6 # v1 | ||
| continue-on-error: true | ||
| with: | ||
| delete-key: ${{ github.repository }}-nextjs-cache-pull_request${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ github.head_ref }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sibling PR disk wiped earlyMedium Severity Cleanup deletes the Next.js sticky disk by Additional Locations (1)Reviewed by Cursor Bugbot for commit cb77e1e. Configure here. |
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fork cleanup key can miss
Low Severity
The delete key relies on
github.event.pull_request.head.repo.fork, but onpull_requestclosedthathead.repocan be null when the source fork was deleted. The expression then omits the-forksuffix, so cleanup targets a different key than the mount used and the ~5 GB disk is left behind.continue-on-errorhides the failed delete.Reviewed by Cursor Bugbot for commit cb77e1e. Configure here.