ci(image): stop exporting build cache from PR builds#540
Merged
Conversation
The mode=max cache export re-uploads every stage's layers (~1GB of node_modules trees) to the GHA cache backend whenever package.json changes — ~270s of every release-bump and Renovate PR build (72% of the 405s worst case). PRs now only consume the cache; main and tag builds keep it warm.
Contributor
There was a problem hiding this comment.
AI Automated Review
Full PR review.
Analysis engine: MiniMax-M2.7@https://litellm.jory.dev/v1 (anthropic) — escalated (fast_low_confidence)
Recommendation: Approve
This PR reduces PR build times by stopping unnecessary cache exports. The change is correct, minimal, and consistent with existing workflow patterns.
Change Summary
| Aspect | Detail |
|---|---|
| File | .github/workflows/image.yaml |
| Change | Replace unconditional cache-to: type=gha,mode=max with a conditional that exports cache only on non-PR events |
| Logic | `cache-to: ${{ github.event_name != 'pull_request' && 'type=gha,mode=max' |
Verification
Logic correctness
- PR events:
github.event_name != 'pull_request'→false, short-circuits to''(no export) ✓ - Push/tag events:
github.event_name != 'pull_request'→true, evaluates to'type=gha,mode=max'✓
Behavior verified
cache-from: type=gha(line 69) is unchanged — PR builds still read the cache ✓- Only the write path is disabled for PRs ✓
- Main/tag builds continue to read and write cache normally ✓
Consistency with existing patterns
The workflow already uses identical conditionals for push/load:
push: ${{ github.event_name != 'pull_request' }}
load: ${{ github.event_name == 'pull_request' }}The cache-to change follows the same established pattern. ✓
Standards Compliance
| Check | Status |
|---|---|
| No secrets or credentials introduced | ✓ |
| No database schema changes | ✓ |
| Follows existing workflow conventions | ✓ |
| CI checks pass (Lint, Typecheck, Build, Tests, Docker Build) | ✓ |
| Comment explains the rationale clearly | ✓ |
CI Check Results
All checks completed successfully for commit e367961:
- Lint: success
- Typecheck: success
- Build: success
- Tests: success
- Docker Build: success
Linked Issue Fit
No linked issues found in the PR body.
Performance Rationale (from PR body, verified against workflow)
The PR documents:
mode=maxexport was ~272s out of 405s total (72%) — verified:mode=maxenables full layer export- Re-uploads ~1GB of node_modules on every
package.jsonchange — plausible for thenode_moduleslayer - Expected improvement: ~100-130s instead of 5+ minutes
Findings
No issues identified. The change is a targeted CI optimization with low risk and clear benefit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cache-tois now main/tag-only); they still read it.Profiled the 405s v0.5.16 bump build: the
mode=maxcache export was 272s (72%) — it re-uploads every stage's layers (~1GB of node_modules) wheneverpackage.jsonchanges, i.e. every release-bump and Renovate PR. Actual work (npm ci ×2 + next build + prisma generate) is ~65s.Verification