chore/update-cloudfront-action#4
Conversation
📝 WalkthroughWalkthroughThe composite GitHub Action for S3/CloudFront deployment is updated to replace a single generic asset upload sync with four targeted sync steps, each applying specific cache-control headers and include/exclude filters. The stale-asset deletion step is revised and a separate ChangesS3/CloudFront deploy upload phase split
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@actions/deploy/s3-cloudfront/action.yml`:
- Around line 71-83: The aws s3 sync command with --delete flag at lines 71-83
excludes files like *.html, _payload.json, and _nuxt/* that are uploaded
separately in lines 49-67, causing stale artifacts to persist in S3 when removed
from new builds. Either create a dedicated aws s3 sync command with --delete
that explicitly includes (rather than excludes) the no-cache file patterns
matching lines 49-67 with appropriate no-cache headers, or remove the exclusions
(--exclude "*.html", --exclude "*/_payload.json", --exclude "_nuxt/*", etc.)
from this sync command so those objects properly participate in deletion when
removed from the build. The goal is to ensure that deleted routes and assets are
actually removed from S3 instead of remaining as stale artifacts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6bf2e1cc-1222-4ad2-8f64-2a047881a005
📒 Files selected for processing (1)
actions/deploy/s3-cloudfront/action.yml
| aws s3 sync .output/public/ s3://${{ inputs.s3-bucket }}/ --follow-symlinks --delete \ | ||
| --exclude "cf-logs/*" \ | ||
| --exclude "_nuxt/*" \ | ||
| --exclude "*.html" --exclude "*.map" \ | ||
| --exclude "robots.txt" --exclude "favicon*" \ | ||
| --exclude "manifest.json" --exclude "site.webmanifest" \ | ||
| --exclude "browserconfig.xml" --exclude "sitemap.xml" \ | ||
| --cache-control "max-age=2592000,public" \ | ||
| --expires 2034-01-01T00:00:00Z | ||
| --exclude "*.html" \ | ||
| --exclude "*.map" \ | ||
| --exclude "_payload.json" \ | ||
| --exclude "*/_payload.json" \ | ||
| --exclude "robots.txt" \ | ||
| --exclude "favicon*" \ | ||
| --exclude "manifest.json" \ | ||
| --exclude "site.webmanifest" \ | ||
| --exclude "browserconfig.xml" \ | ||
| --exclude "sitemap.xml" \ |
There was a problem hiding this comment.
Stale no-cache artifacts are never removed from S3.
The only --delete sync excludes *.html, _payload.json, site metadata, and all _nuxt/*, while those paths are uploaded in Lines 49-67 without --delete. Removed routes/assets from new builds will remain in S3 and can continue to be served.
Use a dedicated --delete sync for the no-cache include set (same include patterns as Lines 49-67, with no-cache headers), or narrow this exclusion set so those objects participate in deletion safely.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@actions/deploy/s3-cloudfront/action.yml` around lines 71 - 83, The aws s3
sync command with --delete flag at lines 71-83 excludes files like *.html,
_payload.json, and _nuxt/* that are uploaded separately in lines 49-67, causing
stale artifacts to persist in S3 when removed from new builds. Either create a
dedicated aws s3 sync command with --delete that explicitly includes (rather
than excludes) the no-cache file patterns matching lines 49-67 with appropriate
no-cache headers, or remove the exclusions (--exclude "*.html", --exclude
"*/_payload.json", --exclude "_nuxt/*", etc.) from this sync command so those
objects properly participate in deletion when removed from the build. The goal
is to ensure that deleted routes and assets are actually removed from S3 instead
of remaining as stale artifacts.
This pull request updates the S3 deployment workflow in
actions/deploy/s3-cloudfront/action.ymlto improve asset caching strategies and refine which files are uploaded or excluded in each deployment step. The changes focus on better separation of immutable, cacheable, and no-cache assets, and ensure more precise cache-control headers for different asset types.Asset upload and cache control improvements:
.output/public/_nuxt/) to S3 with a long-term, immutable cache-control header, and excluded unnecessary files (e.g., source maps, builds, manifest).no-cache,max-age=0) for HTML and other frequently changing files.These changes help ensure that assets are cached appropriately in browsers and CDNs, reducing unnecessary re-downloads and improving site performance, while ensuring that frequently changing files are always
Summary by CodeRabbit
Chores