Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/cache-save/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default async (options: Input): Promise<Output> => {

// Handle Utoo binary cache
if (utooCacheEnabled) {
const utooCacheKey = `utoo-binary-${resolvedVersion}`;
const utooCacheKey = `utoo-binary-${resolvedVersion}-${process.platform}-${process.arch}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This logic for generating the cache key is duplicated in src/cache-save.ts on line 17. To improve maintainability and follow the DRY (Don't Repeat Yourself) principle, consider extracting this logic into a shared utility function, for example in src/utils.ts.

For example:

// in src/utils.ts
export function getUtooCacheKey(version: string): string {
  return `utoo-binary-${version}-${process.platform}-${process.arch}`;
}

This would centralize the key generation, making future updates easier and less error-prone.


info(`Attempting to restore Utoo binary cache with key: ${utooCacheKey}`);
const utooCacheRestored = await restoreCache(utooCachePaths, utooCacheKey);
Expand Down
2 changes: 1 addition & 1 deletion src/cache-save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function run(): Promise<void> {

// Save Utoo binary cache (only if not already cached)
if (state.utooCacheEnabled && !state.cacheHit) {
const utooCacheKey = `utoo-binary-${state.resolvedVersion}`;
const utooCacheKey = `utoo-binary-${state.resolvedVersion}-${process.platform}-${process.arch}`;

info(`Saving Utoo binary cache with key: ${utooCacheKey}`);
info(`Actual installed version: ${state.version}`);
Expand Down
Loading