Add explicit cache input to enable/disable caching#111
Conversation
|
Should we avoid save-cache if |
It already does this, albeit a bit indirectly. When Although we still call I can make it more explicit if you prefer (by re-fetching the input in |
|
Ah, got it. I think it’d be better if it were more explicit, maybe add a few comments to clarify? |
388ce55 to
f1db63c
Compare
|
Done, also updated log messages |
There was a problem hiding this comment.
Pull request overview
Adds a new cache action input to explicitly enable/disable prek environment caching, primarily as a troubleshooting/failsafe switch while keeping caching enabled by default.
Changes:
- Introduces
cacheboolean input (defaulttrue) inaction.yaml, parsing it viagetInputs(), and wiring it into main execution to skip cache restore when disabled. - Updates cache post-step behavior/logging to cleanly no-op when cache state was never initialized.
- Adds/updates unit tests and documentation to cover the new input and behavior.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/main.test.ts | Adds coverage ensuring cache restore is skipped and cache-hit=false is emitted when caching is disabled. |
| test/inputs.test.ts | Adds coverage for default cache behavior and opt-out parsing. |
| test/cache.test.ts | Updates expectation for revised “no cache state” logging when save is skipped. |
| src/types.ts | Extends Inputs type with cache: boolean. |
| src/inputs.ts | Parses the new cache input via core.getBooleanInput('cache'). |
| src/main.ts | Gates restorePrekCache() behind inputs.cache, and sets cache-hit appropriately when disabled. |
| src/cache.ts | Clarifies/adjusts post-step “no state” log message for cases where restore never ran (including cache disabled). |
| src/post.ts | Adds comment explaining post-step always runs and save is conditional on state. |
| action.yaml | Defines the new cache input with default "true". |
| README.md | Documents the new cache input in the inputs table. |
| dist/index.cjs | Updates bundled output for new input + conditional restore behavior. |
| dist/post/index.cjs | Updates bundled output for revised cache-save no-op logging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks! |
Should seldom be manually set, but a worthwhile failsafe for debugging or working around broken environments.