Skip to content

[ci] Cache Hugo resources in docs preview - #294

Open
Mousynano wants to merge 1 commit into
layer5io:masterfrom
Mousynano:feature/Mousynano/281
Open

Mousynano wants to merge 1 commit into
layer5io:masterfrom
Mousynano:feature/Mousynano/281

Conversation

@Mousynano

@Mousynano Mousynano commented Oct 29, 2026 •

Copy link
Copy Markdown

Notes for Reviewers

Summary

This PR adds caching for Hugo-generated resources (resources/_gen) to the docs preview workflow.

Changes

  • Restores cached resources before the preview build.
  • Uses dependency, asset, and content-aware cache keys.
  • Supports cache reuse across content changes.

Before / After

Before After
No Hugo resource caching in PR previews resources/_gen cache configured
Generated resources not restored from Actions cache Cache restoration supported
No cache invalidation strategy Hash-based keys and restore prefixes

Validation

  • Local build and WebP integration verified against academy-theme#252.
  • git diff --check passed.
  • GitHub Actions build and cache restoration pending.

Related issue: Part of #281.

WebP conversion is implemented separately in layer5io/academy-theme#252. This PR only covers preview CI caching, not the downstream theme update.

Signed commits

  • Yes, I signed my commits.

Summary by CodeRabbit

  • Chores
    • Documentation preview builds now reuse generated resources across eligible workflow runs, which may reduce build times. Closed events are excluded from this behavior, and builds can fall back to previously cached resources when the exact match is unavailable.

Signed-off-by: Muhamad Kurniawan Fauzi <krnwnfauzi19@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8630a7dd-4ea3-4db7-8352-6788d7e01f18
Commits

Reviewing files that changed from the base of the PR and between 4cefd3e and 963b701.

Files selected for processing: 1
  • .github/workflows/build-docs-preview.yml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The docs preview workflow now caches Hugo-generated resources in resources/_gen for events other than closed. The cache key uses runner OS, dependency and build-input hashes, and a content hash. Restore keys use the runner OS and dependency-hash prefix.

Changes: Docs preview resource caching

Layer / File(s) Summary
Cache Hugo-generated resources
.github/workflows/build-docs-preview.yml
The workflow adds a cache for resources/_gen on events other than closed. Its key includes runner OS, dependency and build-input hashes, and a content hash. Restore keys match the runner OS and dependency-hash prefix.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Possibly related issues

  • layer5io/layer5-academy issue 281 includes caching resources/_gen in the GitHub Actions workflow. This change adds that cache to the docs preview workflow, but does not address the issue’s WebP conversion or content image mount work.

Suggested reviewers: banana-three-join

Merge Risk: Minimal · up to 963b7

No actionable merge-blocking risk is identified for the preview cache change. Normal workflow checks should complete before merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding Hugo resource caching to the documentation preview CI workflow.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Mousynano Mousynano changed the title ci: cache Hugo resources in docs preview [ci] Cache Hugo resources in docs preview Oct 29, 2026
@Mousynano
Mousynano marked this pull request as ready for review October 29, 2026 03:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant