Skip to content
/ utils Public

Update the cache key#616

Merged
5ouma merged 2 commits intomainfrom
ci-actions-cache-key
Jan 3, 2026
Merged

Update the cache key#616
5ouma merged 2 commits intomainfrom
ci-actions-cache-key

Conversation

@5ouma
Copy link
Owner

@5ouma 5ouma commented Jan 3, 2026

The key should be sortable across the cache.

Copilot AI review requested due to automatic review settings January 3, 2026 02:52
@github-actions github-actions bot added 🍞 Setup Bun with Cache Install Bun and cache project dependencies 🐙 GitHub Actions Common GitHub Actions updates 🚸 pre-commit Check the code with pre-commit hooks labels Jan 3, 2026
@5ouma 5ouma removed the 🐙 GitHub Actions Common GitHub Actions updates label Jan 3, 2026
The key should be sortable across cache.

Signed-off-by: Souma <git@5ouma.me>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restructures GitHub Actions cache keys to make them sortable by moving the tool-specific prefix (e.g., bun-, pre-commit-) before the OS identifier. Note that the PR title references "RubyGems" but the actual changes affect Bun and pre-commit cache configurations.

  • Cache key format changed from ${{ runner.os }}-<tool>-<hash> to <tool>-${{ runner.os }}-<hash>
  • Restore keys updated to match the new prefix pattern for pre-commit
  • This enables better cache organization and sorting across different operating systems

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
setup-bun-with-cache/action.yml Updates Bun cache key to prefix with bun- before the OS identifier
pre-commit/action.yml Updates pre-commit cache key and restore-keys to prefix with pre-commit- before the OS identifier

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@5ouma 5ouma changed the title Update the RubyGems cache key Update the cache key Jan 3, 2026
@5ouma 5ouma force-pushed the ci-actions-cache-key branch from 22cf6a1 to 8899959 Compare January 3, 2026 02:53
@github-actions github-actions bot added the 🐙 GitHub Actions Common GitHub Actions updates label Jan 3, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This change updates GitHub Actions caching key formats across two action configuration files. The pre-commit action cache key now uses a "pre-commit-" prefix with OS suffix pattern, while the Bun setup action reorders cache key components from OS-first to bun-first ordering. No logic or control-flow modifications.

Changes

Cohort / File(s) Summary
GitHub Actions Cache Configuration
pre-commit/action.yml, setup-bun-with-cache/action.yml
Cache key formatting updated in both actions. Pre-commit shifts to "pre-commit-${{ runner.os }}-${{ hashFiles(...) }}" pattern with updated restore-keys. Bun setup reorders key components from OS-prefixed to "bun-${{ runner.os }}-${{ hashFiles(...) }}" format. Changes may affect existing cache hits.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Update the cache key' directly matches the main changeset, which updates cache key formatting in two GitHub action configurations.
Description check ✅ Passed The description 'The key should be sortable across the cache' relates to the changeset's purpose of restructuring cache keys for improved sorting behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci-actions-cache-key

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 and usage tips.

@5ouma 5ouma removed the 🐙 GitHub Actions Common GitHub Actions updates label Jan 3, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
setup-bun-with-cache/action.yml (1)

11-16: Consider adding restore-keys for better cache reuse.

Unlike the pre-commit action, this cache configuration doesn't include restore-keys. Adding a restore-keys entry could improve cache hit rates when the lockfile changes by allowing partial matches:

restore-keys: bun-${{ runner.os }}-

This would allow the action to reuse caches from the same OS even if bun.lock has changed, potentially saving time on dependency installation.

🔎 Proposed enhancement
     - name: 🫙 Cache node_modules
       id: cache
       uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
       with:
         path: ./node_modules
         key: bun-${{ runner.os }}-${{ hashFiles('./bun.lock') }}
+        restore-keys: bun-${{ runner.os }}-
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acb615d and 8899959.

📒 Files selected for processing (2)
  • pre-commit/action.yml
  • setup-bun-with-cache/action.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: 🚸 pre-commit
🔇 Additional comments (2)
pre-commit/action.yml (1)

43-44: LGTM! Cache key format improved for better organization.

The new cache key format prefixes with the tool name (pre-commit-) rather than the OS, which groups related caches together when sorted alphabetically. This achieves the PR's stated objective of making keys "sortable across the cache." The restore-keys pattern is correctly updated to match.

Note: This change will invalidate existing caches, requiring a fresh cache build, which is expected behavior for a cache key change.

setup-bun-with-cache/action.yml (1)

16-16: LGTM! Consistent cache key format applied.

The cache key now follows the same tool-prefixed pattern as the pre-commit action (bun-${{ runner.os }}-...), ensuring consistent cache organization across both actions. This change achieves the PR's objective of sortable cache keys.

@github-actions github-actions bot added the 🐙 GitHub Actions Common GitHub Actions updates label Jan 3, 2026
@5ouma 5ouma merged commit 788e982 into main Jan 3, 2026
5 checks passed
@5ouma 5ouma deleted the ci-actions-cache-key branch January 3, 2026 03:03
@5ouma 5ouma removed the 🐙 GitHub Actions Common GitHub Actions updates label Jan 3, 2026
This was referenced Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚸 pre-commit Check the code with pre-commit hooks 🍞 Setup Bun with Cache Install Bun and cache project dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants