Skip to content
Closed
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
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
cache-dependency-path:
description: "Path to lock file for cache key generation. Auto-detected if not specified."
required: false
cache-save-if:
description: "Whether to save the cache. If false, cache is only restored. Useful for limiting cache writes to specific branches."
required: false
default: "true"

outputs:
version:
Expand Down
4 changes: 2 additions & 2 deletions dist/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function printViteVersion(): Promise<void> {

async function runPost(inputs: Inputs): Promise<void> {
// Save cache if enabled
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The comment says cache is saved “if enabled”, but saving is now additionally gated by inputs.cacheSaveIf. Please update the comment to reflect the actual condition (cache enabled AND cache-save-if true) so the post-phase behavior is clear.

Suggested change
// Save cache if enabled
// Save cache if enabled and the cache-save-if condition is true

Copilot uses AI. Check for mistakes.
if (inputs.cache) {
if (inputs.cache && inputs.cacheSaveIf) {
await saveCache();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/inputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe("getInputs", () => {
runInstall: [],
cache: false,
cacheDependencyPath: undefined,
cacheSaveIf: false,
});
Comment on lines 28 to 32
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

This test sets getBooleanInput to always return false, so it won’t catch regressions where getInputs() reads the wrong boolean input name (e.g. a typo in cache-save-if). Consider adding a focused test that makes getBooleanInput return true only for "cache-save-if" (and/or asserts it was called with that name) and then verifies inputs.cacheSaveIf is true.

Copilot uses AI. Check for mistakes.
});

Expand Down
1 change: 1 addition & 0 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function getInputs(): Inputs {
runInstall: parseRunInstall(getInput("run-install")),
cache: getBooleanInput("cache"),
cacheDependencyPath: getInput("cache-dependency-path") || undefined,
cacheSaveIf: getBooleanInput("cache-save-if"),
};
}

Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface Inputs {
readonly runInstall: RunInstall[];
readonly cache: boolean;
readonly cacheDependencyPath?: string;
readonly cacheSaveIf: boolean;
}

// Lock file types
Expand Down
Loading